New action: Run tests in parallel
Testing is essential to keeping high quality of code. However, it can also prove very time-consuming if you run a large number of tests. To reduce testing time, we have introduced a new action that will let you split your tests in packages across several actions and run them in parallel.
How to split tests in your pipeline
- Create a new pipeline in your project.
Choose 'Split tests' action from the actions list.
Image loading...
Select the number of groups (packages) into which you want to split the tests. In this example, we'll use 3 packages.
NOTE: make sure not to exceed the maximum number of parallel actions allowed in your account.
Choose if you want to sort them alphabetically or by file size.
Provide the path to the directory with test files. You can do it in two ways:
a). Select one file with the paths to split (each path in a separate line)
b). Use glob patterns:
*
matches any sequence of characters (excluding path separators)**
matches any sequence of characters (including path separators)?
matches any single character (excluding path separators)[abc]
matches any character (excluding path separators) against characters in brackets{foo,bar,...}
matches a sequence of characters, if any of the alternatives in braces matches
Once done, save the action:
Image loading...
The action creates environment variables required to run the tests in parallel:
$BUDDY_SPLIT_1
,$BUDDY_SPLIT_2
,$BUDDY_SPLIT_3
, and so on. Once the pipeline is executed, you will see them in the logs.Image loading...
Next, you need to prepare the environment for the tests (install dependencies etc.) in the selected build action:
Image loading...
The last part is adding the actions that will run the tests using the proper variable from the 'Split tests' action:
Image loading...
You can see we have added 3 testing actions – this is because we chose to split the tests into 3 actions: Image loading...
Bonus feature: Parallel deployments
Once your tests have passed, you can prepare a production build of your application and deploy it to several servers at once using parallel actions:
Image loading...
Jarek Dylewski
Customer Support
A journalist and an SEO specialist trying to find himself in the unforgiving world of coders. Gamer, a non-fiction literature fan and obsessive carnivore. Jarek uses his talents to convert the programming lingo into a cohesive and approachable narration.