Skip to main content

TestCafe Quickstart

Use saucectl — the Sauce Labs test orchestrator CLI — to run TestCafe tests directly from your existing TestCafe project.

  • Don't have TestCafe tests, but want to try? The TestCafe Demo Repo includes a sample project structure, working configuration file, and sample TestCafe test so you can get up and running in less than 10 minutes!
  • Already running TestCafe? Let saucectl run your tests in the Sauce Labs Cloud, where you have access to thousands of OS/browser combinations and Sauce Labs analytics.

What You'll Need

Step 1: Install saucectl

npm install -g saucectl

saucectl requires access to a valid Sauce Labs account.

Use Environment Variables

saucectl detects your Sauce Labs credentials environment variables and prioritizes them over values in the credentials.yml file when both are present. If you have set them, you may skip this step. Not sure if you have them set? Run the following command to check:

echo $SAUCE_USERNAME
echo $SAUCE_ACCESS_KEY

If a value is returned for both variables, they are set.

  1. Run the configure command:

    saucectl configure
  2. Enter your Sauce Labs Username and Access Key at the prompts.

Step 3: Clone the TestCafe Project

git clone https://github.com/saucelabs/saucectl-testcafe-example.git

Step 4: Run Tests

Navigate to the root of the TestCafe project you just cloned, then use the run command to execute the sample test included with the saucectl example.

cd saucectl-testcafe-example
saucectl run

The console displays the executing tests, distinguishing which mode is running.

The results and test assets are available immediately following test completion in your Sauce Labs account.