This repository has been archived by the owner on Feb 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 115
Parallel Tests
rtyler edited this page Dec 10, 2012
·
5 revisions
Running parallel Cucumber and Capybara based tests on top of Sauce is very easy. This document covers using the parallel_tests gem for running multiple Cucumber features at once.
The parallel_tests
gem provides two executables, parallel_rspec
and parallel_cucumber
, which use the gem's parallelization magic to invoke rspec
or cucumber
respectively.
If for example, you had a dual core computer, and a features/
directory with 10 .feature
files in it, you could run:
% bundle exec parallel_cucumber features
And the command would run a two Cucumber processes at the same time, each executing one of the 10 feature files.
In order to run parallel tests effectively, your test code must be able to run at the same time as other tests.
- Avoid forcing your tests to start up a server process, not only does this slow things down, but it also increases the likelihood that your tests will try to start a server at the same time and conflict. Instead use a remote staging environment, ideally one that closely represents production and can handle many clients simultaneously
- Avoid shared or hard-coded data in your tests, if you need an email address or some other form of fake data, generate it yourself (check out the Faker gem).