Installing TestCafe

This guide will help you install TestCafe, an open-source, Node.JS-based end-to-end testing framework for web apps.

End-to-end testing is a technique to test an application flow from start to finish. It tests the application and its components for integration and data integrity in a product-like setting by simulating a real user scenario.

Together with unit and integration tests, end-to-end tests play an important role in your quality assurance process and can help you confirm that the application works as expected.

Unlike other solutions, TestCafe is not built on Selenium, which allows it to provide features that are not available in Selenium-based tools (for example, testing on mobile devices, user roles, automatic waiting, etc.). As it doesn't use WebDriver to work with browsers, it only requires a minimal testing environment and is installed with a single command.

TestCafe runs on Windows, MacOS, and Linux, and supports desktop, mobile, remote and cloud browsers (UI or headless). See a list of supported browsers here.

Requirements

To follow the steps in this tutorial, you need NPM (Node.js Package Manager), that you have already installed to install and update the pos-cli. You should also be familiar with TestCafe:

Steps

Installing TestCafe is a two-step process:

Step 1: Install TestCafe

Enter the following in your command line to install TestCafe:


npm install -g testcafe

You can follow the installation process in your command line (something similar to this will be displayed after the process has ended):


/usr/local/bin/testcafe -> /usr/local/lib/node_modules/testcafe/bin/testcafe-with-v8-flag-filter.js
+ testcafe@1.0.1
added 322 packages from 239 contributors in 18.038s

Step 2: Test and run TestCafe

Use the following command to test if you've installed TestCafe successfully:


testcafe -v

If TestCafe has been installed correctly, running this command displays the version number. If it hasn't been installed, running this command gives a command not found error.

After installed, you can run TestCafe from a command line by using the testcafe command. See a list of available commands and options here.

Examples

See complete TestCafe test suites and file organization examples on platformOS sites in the following public repos:

Next steps

Congratulations! You have installed TestCafe. Now you can write your first test:

Questions?

We are always happy to help with any questions you may have.