How to Run Cypress Test Cases Faster With Parallelization

KailashPathak
3 min readFeb 27, 2021

--

Pre-Condition :

How to set up CircleCI follow below link

https://kailash-pathak.medium.com/cypress-test-case-execution-in-ci-cd-using-circleci-fab21028a169

What covered in this blog

Store test screenshots and videos as CircleCI artifacts

How to record cypress tests in cypress dashboard

Run cypress test case in parallel in CircleCI /cypress dashboard

Test cases execution result in CI machines

S) Store test screenshots and videos as CircleCI artifacts

Steps 1: We have to update config.yml with “store_artifacts: true”

Step 2: Push the code job is started in CircleCI itself. Once test case execution is done in CirecleCI under ARTIFACTS Section we can see the screenshot (*of failed test cases) and video

H) How to record cypress tests in Cypress dashboard

Steps 1 We have to update config.yml with “record: true”

Step 2: Push the code job is started in CircleCI itself as we have given “record: true” in the cypress dashboard we can also see the passed test cases

R) How to run the cypress test case in parallel in CircleCI /cypress dashboard

Steps 1 We have to update config.yml with the below configuration

Step 2: Push the code job is started in CircleCI itself. See in below screenshot 4 test cases are running in “4” CI machine in Parallel

Step 3: We can see the result of test case execution in the cypress dashboard as well. In below screenshot

T) Test cases execution result in CI machines

01 Machine for all FOUR test cases taking ~0:36 Second

02 Machine for all FOUR test cases taking ~0:18 Second

03 Machine for all FOUR test cases taking ~00:13 Second

04 Machine for all FOUR test cases taking ~00:10 Second

Cypress Test case run Balance strategy

Cypress will automatically balance your spec files across the available machines in your CI provider. Cypress calculates which spec file to run based on the data collected from previous runs. This ensures that your spec files run as fast as possible, with no need for manual configuration.

Cypress can distribute spec files to available CI resources in descending order of spec run duration. In this manner, the most time-consuming specs start first which minimizes the overall test run duration.

See more blogs on Cypress Under the below link

--

--

KailashPathak
KailashPathak

Written by KailashPathak

|| Cypress.io Ambassador || https://qaautomationlabs.com/blog || PMI-ACP® |ITIL® || PRINCE2® || Cypress|| Selenium| WebdriverIO |API Automation QATube®