Configuring your GitLab CI/CD pipeline to run your automated tests with parallel jobs is a great way to improve your build times and provide faster feedback to your dev & QA teams. It can be frustrating to wait a long time for your tests to complete when new code is committed to your project repository. Not only does running your test jobs in parallel reduces wait times, it also enables you to release new updates to production faster without reducing the number of tests you can run.
If you haven't set up GitLab to run your automated tests yet, you can also read our introduction article on GitLab CI/CD test automation first.
Fortunately GitLab makes it very easy to set up parallel execution of your automated tests. You just need to understand a few basic concepts and learn a couple of configuration options to implement this. In this guide we will go through all these details so you can speed up your test automation runs, as well as report your test results to test management. Let's get started!
GitLab CI/CD Parallel Testing Workflow
To run our tests in parallel as part of our GitLab CI/CD pipeline, we need to tell GitLab to start multiple test jobs at the same time. In each of the test jobs we then run a different subset of our test suite.
For our example project we start by adding separate
deploy jobs. For our purpose we wouldn't really need the build and deploy steps, as we will focus on the testing tasks here; but we want to create a full example so it's easier for you to implement a full workflow based on this article.
Our initial pipeline will start executing the
build job, followed by multiple parallel
test jobs and then finally run
deploy if all tests passed (GitLab will stop the pipeline if any of the test jobs fail):