Recipe 7Test Across Multiple Cores

Problem

You want to give your tests a quick speed boost by distributing them across all the cores on your development machine.

Ingredients

  • The parallel gem[45] for distributing tasks within a single test

  • The parallel_tests gem[46] for distributing entire features across multiple cores

Solution

Unless you tell it otherwise, Cucumber typically runs your features in a single process containing a single thread. Modern desktop machines often have multiple cores; even my little travel computer has two. By breaking work into pieces and farming them out to all the cores on your machine, you can run your tests faster.

Parallel Tasks

Imagine you have the following scenario in features/shipping.feature:

multiple_cores/parallel/features/shipping.feature ...

Get Cucumber Recipes now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.