2 CPUs = 2x Testing Speed for RSpec, Test::Unit and Cucumber
open sourceMITself-hostablefree
parallel_tests runs a Ruby test suite across all CPU cores: it splits the test files into balanced groups, by file size or by runtimes recorded from earlier runs, and runs each group in its own process with its own database (TEST_ENV_NUMBER picks it). It supports Minitest, RSpec, Turnip, Cucumber and Spinach, has rake tasks to create and prepare one test database per process, and can run only the files matching a pattern. The same runtime logs let CI split a suite across machines.
Problems it solves
- our RSpec suite takes 40 minutes and only uses one CPU core
- run Rails tests in parallel, each with its own test database
- split the test suite evenly across CI machines by how long each file takes
- tests clash when they run at the same time because they share one database
- make the Cucumber suite finish faster on a many-core machine
- rerun only the tests for the user model in parallel
- balance test groups so one slow group doesn't hold up the build
Features
- groups by file size or recorded runtime
- one database per process (TEST_ENV_NUMBER)
- rake parallel:create, parallel:prepare, parallel:spec
- Minitest, RSpec, Turnip, Cucumber and Spinach
- file patterns to run a subset
- runtime loggers for even groups
- combined summary output
