Posted

2 minutes read

TestCafe is a Node.js tool to automate end-to-end web testing.

testcafe

What are End to End tests and why are they important?

End to End tests cover real journeys that your customers do, they are slower to execute but can be much more valuable comparing to unit and integration tests.

E2E testing cons:

  • slow and non-consistently passing tests
  • long configuration time
  • too long execution time – much longer than unit tests
  • debugging time is too high

What is TestCafe? History of TestCafe and how does it work?

TestCafe is a Node.js tool to automate end-to-end web testing and functional testing.

TestCafe uses a URL-rewriting proxy called Hammerhead that emulates commands using the DOM API and injects JavaScript into the browser.

TestCafe supports multiple browsers without any browser drivers.

It runs every single test in its own isolated test environment to simulate new sessions.

Each test has finished being executed, it will lose the state (cookies, local storage etc) of the page and start from the beginning again.

Main TestCafe features:

  • Cross-browser testing
  • Open source
  • Easy setup/installation
  • UI End to End Tests
  • Builtin waits
  • Retry assertions
  • Uses standard CSS selectors to locate elements
  • Live Testing with TestCafe Live
  • Remote browser/mobile testing: run tests in any browser (including mobile devices and cloud services)
  • No complex configuration required
  • Can control the speed at which tests are run
  • Concurrency: run multiple tests with same or different browsers at the same time
  • CI/CD integration
  • Screenshots testing
  • Supports TypeScript

Example of Test in TestCafe:


import { Selector } from 'testcafe';

fixture `Getting Started`
    .page `http://devexpress.github.io/testcafe/example`;

test('My first test', async t => {
    // Test code
});

More details on How to Build an End to End Software Testing Framework with TestCafe in our Coursinator course.

More details on How to Build an End to End Software Testing Framework with TestCafe in our Coursinator course.