Goodbye Selenium?

If you’re a QA it’s unlikely that you’ve never come across Selenium. It’s such a popular tool that it’s almost a synonym for Test Automation. Or it was until recently. It’s a tool with great community support, great language support, and a number of frameworks built on it with more features and flexibility (WebdriverIO, Protractor, CasperJS to name some).

However, in recent times, we want more from an automation tool and it feels like Selenium lacks some features we need, especially with the arrival of Single Page applications and with a lot of focus asynchronous operations and client-side performance. Single page application and asynchronous calls made the life of writing tests in Selenium tedious. Managing waits, waiting for page load, setting up expected conditions and writing tests; not so easy. Selenium required not so simple configurations to get what we need. To name a few:

  • Getting/Installing drivers for browser support.
  • Creating capabilities and profiles.
  • Matching of driver and browser versions to avoid compatibility issues.
  • Grid configuration and separate launchers for running the tests in parallel.
  • Clear demarcation of parallel runnable tests so that they don’t run into each other’s states.

New Kid on the Block

We have TestCafe which is a product of DevExpress and it solves the issues mentioned above. TestCafe is a mature framework built from scratch which is built on Node.js. The fundamental difference between Selenium and TestCafe is that Selenium runs the code in the browser process itself, whereas TestCafe uses a Proxy in between which performs URL rewriting, and injects the test scripts into the browser. Since these proxies manage all storage/cookies for the tests, you get a clean and isolated test environment which is difficult (or impossible) to achieve in Selenium. This will allow us to run tests in parallel using different roles, without having the fear of the tests interfering with states of each other.

Main Features of TestCafe

  • Open Source framework.
  • One line install and boiler plate configurations (npm install -g TestCafe)
  • Can detect all the browsers installed on your machine including legacy IE and run the tests on them without having to install/configure something. Browser Support.
  • It can run tests in headless mode in both in Chrome and Firefox, without having to render DOM (TestCafe Chrome:headless tests/*.js)
  • Can run tests in parallel and on different browsers without complex configurations (eg: TestCafe-c 4 safari, Firefox tests/test.js)
  • Can run tests on remote desktops, mobiles and cloud browsers. Remote
  • It can run tests on Chrome device emulation (eg: TestCafe “chrome:emulation:device=iphone 6” tests/sample-fixture.js)
  • Automatic Waiting Mechanisms and Smart Assertion Query Mechanism which helps to create more stable and faster running tests.
  • Support for TypeScript language, to leverage the benefits of a strongly typed Object Oriented Programming language.
  • Ability to create multiple user roles and switching user roles inside the tests, TestCafe manages all the state and cookies for you. Test Cafe User Roles
  • Functional style selectors (Selector(‘label’).withText(‘foo’), Selector(‘li’).filter(‘.someClass’)) Test Cafe Selectors
  • The ability to use framework specific selectors if its required or convenient (you can use a mix of them as well) eg: React, Angular, AngularJs, Vue, Aurelia
  • Ability to intercept HTTP responses
  • Ability to Mock HTTP Responses
  • Observes JS errors (fails the test if there’s a script error if you would like)
  • Multiple reporters (spec, minimal, JSON, NUnit, TeamCity, Slack!), and option to customize the reports
  • Easy integrations with CI tools. CI Support
  • Easy debugging in VS Code/ Chrome DevTools. Debugging

Give TestCafe a try, I’m sure you would love it 🙂

More from DevExpress

Reference

3 COMMENTS

  1. Hi, 

    Thank you for your article. TestCafe is produced by DevExpress, not DevExtreme. 

    DevExtreme is another HTML/JS product developed by DevExpress.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

*