Cypress parallel testing with Jenkins Pipeline stages
In this tutorial for JavaScript end to end testing, you will learn about Cypress test runner for UI automation testing and how to use it with Jenkins CI server. Cypress helps with frontend automation testing using headless browser or just regular browser. E2E tests often take a long time to run and for bigger projects, those type of tests can take dozens of minutes or even hours. To save developers time you want to load balancing Cypress tests across Jenkins parallel pipeline stages. Thanks to that you can run your 1-hour test suite in a few minutes.
How to speed up Cypress tests
Cypress is a Javascript End to End testing framework that has built in parallelisation but in this article, we will cover Cypress parallel without dashboard service. You want to be able to run tests also when external Cypress dashboard service API is down. It’s possible thanks to Knapsack Pro client for Cypress with built-in Fallback Mode.
Run Cypress tests in parallel with Jenkins Pipeline
You may want to run Cypress concurrent tests but for that, we will use declarative Jenkins Pipeline with defined Jenkins stages. This allows us to run Cypress parallel tests.
Let’s look at this Jenkins Pipeline as a code to understand Cypress Jenkins integration:
How dynamic tests split works in Knapsack Pro Queue Mode
To better understand how test suite split works when you allocate tests in a dynamic way across parallel stages please see below video. You will find here more edge cases that can be solved when running tests in parallel and how Knapsack Pro Queue Mode helps with CI parallelisation. Ensuring each of your parallel tasks run a similar amount of time is important to get optimal CI build time and thanks to that save you as much time as possible.
To compare Jenkins with other CI solutions, check out our popular comparison pages: Jenkins vs Github Actions, Drone vs Jenkins, AWS CodeBuild vs Jenkins, Cloud Build vs Jenkins, Jenkins vs Other CI providers.