Speed up Cucumber tests by running on several machines
At Traiana, we use Jenkins to run the cucumber tests suite. To run much faster - tests can be distributed using a setup as follows
This is an example of jenkins setup, splitting to 7 workers:
"Orchestrator" is the entry-point job.
Orchestrator will call the "Splitter" job. the splitter does his little magic and divides the features files into slices, where each slice will get a cucumber tag running from @worker_1, @worker_2, ... , @worker_N .
Next the Orchestrator will run the "workers" jobs - T1, ...,Tn in parallel (using - Build Flow Plugin )
After all of the workers jobs are done, Orchestrator will call the "Join" job, which will take all the reports of the workers jobs and join them to the final report.
- Jenkins installation with Build Flow Plugin
- ruby installed
the splitter is using split_to_workers.rb ruby script. the script gets as parameters:
- the root directory in which your features files are located
- number of workers
It uses dry-run to count how many scanrios we have in total (excluding @not_ready tag) Then iterate over all the feature files, prepending tags, such as @worker_X, to the first line of each file. It uses a round-robin algorithm, to balance the workers to have simillar amount of scenarios each.
Then pushes the resulting feature files with the tags to a temporary git branch, let's call it "parallel-branch"
the workers will checkout out "parallel-branch" created in the splitter, then run your test suit, each with the corresponding tag