What Is TestCafe NodeJs Test Automation

TestCafe Test Automation Tool

What Is TestCafe NodeJs Test Automation

I recently wrote a blog post on the top test tools TestTalks guests have recommended, and I immediately began getting comments from folks asking why TestCafe was not on the list.

So I decided to invite Julian Bucknall, CTO of DevExpress, the makers of TestCafe, to discuss it on my podcast Test Talks.

So, here’s the deal.

First – Why was TestCafe Created?

The primary reason DevExpress created TestCafe was that they were creating user interface controls for mobile Web apps, and during that process, they found that they were having a lot of issues testing those controls for mobile devices.

The developers started off trying to use Selenium, but they were having issues concerning browsers.

Most folks use the latest version of their browsers.

Because DevExpress sells to enterprises, they have to be able to support all the different browsers and versions.

So if a company is using Internet Explorer 9, or whatever it happens to be, they have to be able to say their controls work with IE9. If they don’t, they have to fix it.

They also had to have some way of doing regression testing, so that when they did a fix or a new feature it would still run on all the different browsers and versions as well.

IE Browser Automation

TestCafe Support Legacy Versions of Browsers

If you use Selenium, being able to quickly test older browser versions–especially an older version of IE–you may as well give up.

Unfortunately, even in this age, many large companies don’t keep up with the latest version of the OS, or a related version of the browser.

In those cases, you still need to be able to quickly and easily run your test against various sets of browsers.

The great thing about TestCafe is that it was created for that exact purpose–to easily support running tests against older browser versions.

So to summarize, it was basically created to support a whole bunch of browsers and all the different legacy versions, because it was a scenario that Selenium couldn’t handle.

TestCafe is Easy to Install

Besides making TestCafe with all the existing browsers and open source, they also wanted it to be easy to install.

It’s JavaScript/Node.JS-based, so all you have to do to get started is run:

npm install -g testcafe.

It’s also cross-platform and cross-browser.

Does TestCafe Only Work for DevExpress Controls?

Since this tool was created by DevExpress to test their custom controls, you may be wondering whether it only works for applications that use DevExpress controls.

The answer is No. You don’t have to use their controls to use TestCafe. It’s completely separate.

The bonus is they have excellent open-source documentation as well.

Why Choose TestCafe as your test automation tool of choice?

If you work for a large enterprise and need to support customers that use older browsers, you should definitely give TestCafe a try. Just like Selenium, it’s free and open source but you don’t need to install any other software or web drivers.

For example, to run again all the browser on my machine all I had to do was create my script Testcafe.js:

import { Selector } from 'testcafe'; // first import testcafe selectors</code>

fixture `Getting Started`// declare the fixture
.page `https://joecolantonio.com/SeleniumTestPage.html`; // specify the start page

//then create a test and place your code there
test('My first test', async t =&gt; {
await t
.typeText(Selector("input").withAttribute("name","fname"), 'Joe')
.typeText(Selector("input").withAttribute("name","lname"), 'Colantonio')
.click('#refreshButton')

});

And to run again different browsers I just need to pass the browser to run against in the run command:

TestCafe run test command

testcafe safari Testcafe.js
testcafe firefox Testcafe.js
testcafe chrome Testcafe.js

No need to download any drivers or specify anything in my PATH or pass the path to a driver. Nice and simple. Just the way I like it

I work for a company who has hospital application users who still use IE9, so this would be an excellent tool to check out in this instance.

As always, there is no perfect tool. Use the tool that works for your team, not what happens to be the most popular tool at the moment.

Learn More About The Automation Tool TestCafe 

For a deeper dive into this automation tool, be sure to listen to my full interview with Julian Bucknall, CTO of Developer Express.

Also check out their Github page.

Click here to add a comment

Leave a comment: