Cypress parallel testing
January 14, 2022

How to Do Cypress Parallel Testing

Automation
Continuous Testing

In this blog, we will show you how to conduct Cypress parallel testing for your web apps efficiently with Cypress and Perfecto.  

It could take lots of time for tests to finish running on one computer if your project has a lot of them. When executing tests in Continuous Integration, running them in parallel across virtual machines saves your team time and money (CI). 

Since version 3.1.0, Cypress can execute recorded tests in parallel across many computers. While parallel tests can run on a single computer, we do not recommend this because this requires a lot of resources to perform your tests efficiently. Here is our guide to Cypress parallel testing with Perfecto.  

Related Resources >> Intro to Parallel Testing: How It Works, Benefits, & Challenges

Back to top

Why Cypress Parallel Testing? 

There are many reasons to use Cypress for web testing either instead of or in tandem with other web testing frameworks. Here are some of the key features and benefits:  

Time Travel 

Cypress takes snapshots as your tests run. Users can hover over commands in the Command Log to see what happened at each step.  

Debuggability 

Users can debug directly in Developer Tools. It gives readable errors and stack traces that make debugging lightning fast. 

Automatic Waiting 

Cypress never adds waits or sleeps to your tests. It automatically waits for commands and assertions before moving on. 

Spies, Stubs, and Clocks 

Cypress verifies and controls the behavior of functions, server responses, or timers.  

Network Traffic Control 

Easily control stub, and test edge cases without involving your server. You can stub network traffic however you like. 

Consistent Results 

Cypress architecture does not use Selenium orb WebDriver. That is why it is fast, consistent, and provides reliable results that are flake-free.  

Screenshots and Videos 

View screenshots that are taken automatically on failure, or videos of your entire test suite when run from the CLI. 

Active Community 

Cypress is a free and open-source framework. It operates on a freemium model, where you can use the free version or paid version. The paid version includes advanced features, such as a dashboard with artifacts, such as DOM snapshots, which are helpful for debugging, as well as video storage. Interest is growing in Cypress, and it boasts an active community on GitHub, Gitter, and StackOverflow.  

Back to top

Cypress and Perfecto  

Perfecto developed a Cypress SDK that allows developers and test engineers to upload, execute or schedule from CI. This SDK is fully agnostic to any Cypress version.  

Before performing parallel testing, you need to set up Cypress in Perfecto. This article walks you through setting up the Perfecto-Cypress integration.  

Back to top

How to Perform Cypress Parallel Testing With Perfecto  

Here is a step-by-step guide to parallel testing with Perfecto and Cypress.   

1. Cypress SDK Installation.  

First, visit npmjs.com  and install npm i perfecto-cypress-sdk. 

2. Cypress Setup With Perfecto for Parallel Execution.  

Install the Perfecto-config.json file and define the different platforms you need to set up.  Next, run the command perfecto-cypress-run with the config.json. 

Now you can see all the spec.js files. This is a native Cypress example that comes with the framework and does a variety of things on the demo website Cypress provides. Configure and upload all the tests (both functional and API) as a zip file to the demo cloud.  

3. Cypress Execution in the Cloud.  

If you go into the cloud, you can see the test being configured and uploaded through a zip file. The benefit of Cypress’s tests is that they run on the VMs themselves, which is very fast and less flaky.

Windows computer on right side with cypress execution on the left in the cloud

4. Cypress Test Execution Monitoring & Analysis.  

After the execution ends you will see all the test reports with the Cypress logs, the visuals, recordings, and other configurations that are coming with the test case themselves.  

On the right-hand side of the screen below is the Cypress framework where the tags are being added to Cypress and SDK.  These are the things that you configure in the .json file for the report to be generated within a sheet. 

Cypress Test Execution Monitoring & Analysis.

If you want to learn more, visit  Perfecto’s help website. You can see the full video of the recording of the Cypress test below.  In addition to Perfecto, Cypress can support parallel testing through their CI and advanced dashboard, here is their guide to parallelization

How to do Cypress Parallel Testing Tutorial

Perform Cypress Parallel Testing With Perfecto 

Open source only takes you so far. Perfecto is an end-to-end cloud testing platform that works with tools like Cypress, Jenkins, Selenium, and more, and syncs them all together so you can execute at scale. Pair Cypress with Perfecto for even faster web testing at scale. Access the browser permutations you need to test against in the cloud. And move faster with parallel testing and bursting. 

Perfecto makes testing with Cypress even better with end-to-end continuous testing support. 

Free Trial  

Demo  

 

Additional Resources

Back to top