Blog/

Product Updates

Parallelize Your JavaScript Tests In CI/CD

saucectl makes setting up, writing, and running web tests easier and faster for developers during early pipeline testing. This blog post explains how you can use this tool to speed up your native JavaScript tests by running tests in parallel within your CI/CD environment.

October 14, 2020

Parallelize Your JavaScript Tests In CI/CD

saucectl makes setting up, writing, and running web tests easier and faster for developers during early pipeline testing. It supports Puppeteer, Cypress, TestCafe, and Playwright to provide the flexibility to test the way you want, along with Sauce Labs insights, at scale. 

You can speed up your native JavaScript tests by running tests in parallel within your CI/CD environment. This capability is available with any Sauce Labs account, and you can get started for free! This means you can make the most of your existing infrastructure without new investments, while still getting insights within Sauce Labs. 

How to Run Cypress Tests in Parallel with Sauce Labs

In this example we’ll take a look at setting up and running Cypress tests in parallel using saucectl with GitHub Actions. Then we will view the test results in the Sauce Labs UI.

Note: Find examples for using other test frameworks or CI/CD examples in the documentation

Prerequisites: You’ll need a Sauce Labs and a GitHub account. You will also need existing cypress tests. In our example we have multiple tests located in the ./tests/e2e/cypress directory.

1. In your root project directory, create the following directory tree: .github/workflows. 

2. And then add your Sauce Labs credentials to the GitHub Actions Secret Settings. 

Screen Shot 2020-10-14 at 11.05.28 AM

3. Add a ./sauce/config.yml, similar to this example, and set parallel to true

a. This will distribute and run the tests across as many jobs as you have defined in your CI

parallel: true

4. Create Github Action test.yml .github/workflows/test.yml

In this example, we’re adding two parallel jobs: cypress-parallel-1 and cypress-parallel-2

Screen Shot 2020-10-14 at 1.17.44 PM

5. Now, when you commit these files, GitHub will detect the new workflow actions and launch saucectl to run your tests. 

The output may look like this:

github-action-parallel-results

Congrats! The tests are now running in parallel with the help of saucectl and you can view screenshots, videos, and test results in Sauce Labs.   

Sauce Labs is committed to supporting our users in delivering digital confidence, and providing what they need to test better, test faster, and test at scale.

On This Page

Free trial

Sign up Free

Start testing smarter with the world's largest continuous testing cloud — now with AI built in.

Start Testing

Keep reading.

VIEW ALL POSTS
Product Updates
VIEW ALL POSTS