Why TestCafe?

TestCafe excels where other end-to-end testing solutions fall short.

The benefits of TestCafe

  • No 3rd-Party Dependencies

    TestCafe does not depend on Selenium or other testing software. TestCafe runs on the popular Node.js platform, and makes use of the browsers that you already have. For many users, the installation process consists of a single step:

    npm install -g testcafe
    
  • Human-readable JavaScript tests

    The core components of our Node.js API are easy to use, even with little to no prior knowledge of JavaScript.

  • A first-class citizen in the Node.js ecosystem

    Like all Node.js scripts, TestCafe tests can leverage the capabilities of third-party JavaScript libraries and preprocessors.

  • No compromises

    The advanced features of TestCafe help you test complex, security-sensitive web applications.

  • Mock Requests

    Emulate HTTP responses to feed sample data to your app, troubleshoot connectivity errors, and cheat downtime.

  • Client-side injections

    Execute custom client-side code to parse the web page, examine its state, or even add extra dependencies.

  • Frames and windows

    Make use of multiple browser windows to test out complex user interactions. Switch to and from iframes with ease and stability.

  • Concurrent tests

    Run your tests in multiple browsers at once to quickly uncover browser-specific errors.

  • API testing

    TestCafe includes a comprehensive set of server-side API testing tools. You can add dedicated API tests to your test suite, or include API testing methods in existing functional tests.

  • Made with automation in mind

    • Automated waiting

      Manual timeouts are a thing of the past. Asynchronous from the ground up, TestCafe knows when to wait and what to wait for before a test can continue.

    • Automated authentication scripts

      Save and activate user roles to easily switch between different user accounts.

    • Hooks

      Keep your code clean with hooks — routines that are repeated before and after each test.

  • Superior User Experience

    • TestCafe Studio

      The GUI and the test recorder built into TestCafe Studio make our product accessible to people with zero programming experience.

    • TestCafe Live

      Enable Live Mode to restart your test every time you make changes to the test file.

  • Debugging assistance

    Enter debug mode to examine your app, troubleshoot Selector queries, and fix failing tests.

  • Community-driven

    • Free and Open Source

      TestCafe is distributed for free under the MIT license.

    • Actively maintained

      The TestCafe team is quick to respond to GitHub issues and StackOverflow questions. Community suggestions shape the future of the product.

    • In-house support

      All TestCafe Studio Pro customers (subscribers and trial users alike) receive prompt, proactive support directly from the package maintainers.

An architecture like no other

TestCafe uses the native CDP protocol to automate local Chromium-based browsers. Native automation allows TestCafe to faithfully recreate user interactions with low-level, high-speed browser access.

A custom-made reverse proxy allows TestCafe to automate other browsers, including cloud browsers and browsers on remote devices.

A hybrid approach

TestCafe’s hybrid client-server architecture lets it execute both system-level and in-browser code.

  • TestCafe uses high-level system APIs to launch and manage browsers. This is necessary to control the test execution process.
  • TestCafe tests are Node.js scripts. They can launch services and applications, read and write system files, make use of your favorite libraries.

Early versions of TestCafe ran entirely in the browser. A hybrid architecture allowed us to improve test stability and extend the framework’s testing capabilities.

Page proxying

If you disable native automation, TestCafe automates browsers with the testcafe-hammerhead proxy. The proxy allows you to run tests in browsers that aren’t based on Chromium, remote browsers, and cloud browsers.

The testcafe-hammerhead proxy intercepts browser requests and injects automation scripts into the requested pages. When the proxy receives data, it changes all the URLs on the resource so that they point to the proxy. This means that neither the client-side code nor other resources in use can tell that the page has been modified. To conceal automation scripts from the rest of the page code, TestCafe also intercepts some of the requests to the browser API.

The proxying mechanism ensures that the page appears to be hosted at the original URL even to the test code.

Browser sandboxing

At the end of each run, TestCafe deletes all browser cookies, empties the storage, and reloads the page, thereby preventing undesirable interference with later tests. You don’t need to write boilerplate code to reset the app state and reverse the changes your tests make.

Tests that run in parallel operate in independent sandboxed environments. This helps prevent server-side collisions.

Client-Side scripts

Some testing scenarios require the execution of custom client-side code. There are three ways to do it with TestCafe:

Client Scripts inject custom JavaScript files, such as temporary extra dependencies, into the page. Client Functions evaluate user-defined JavaScript expressions and pass their return value to the server side. They are useful when you want to examine the page or access its URL. Selectors can execute client-side functions to locate DOM elements.

Note

The TestCafe documentation describes the limitations of user-defined client-side scripts.

Try it yourself

Try TestCafe for yourself and see how the features it packs can make your life easier. Create your first test in under 5 minutes by following our Getting Started Guide.