Run your Cucumber on multiple CPUs.
Simply copy the rake task to lib/tasks
in your Rails project.
RAILS_ENV=test rake salad:features
At the moment you explicitly need to set RAILS_ENV
to test
. The first time you run it, it will create and migrate the necessary database tables, so make sure your user for the test
environment has privileges to create additional databases. Additional databases for the extra Cucumber processes are created by appending _#{i}
to the test database as defined in your config.yml
. This means it will not interfere with your regular test database. You can run this task and your specs at the same time.
Ctrl-c
aborts all running processes.
You can configure the arguments passed to Cucumber by editing the rake task. The number of Cucumber processes is determined by the SALAD_INSTANCES
environment variable which, if not explicitly set, defaults to 4.
It is assumed your features live under RAILS_ROOT/features
, if this is not the case you can change the features_dir
variable in the script.
When in doubt, read the script. ;-)
- Sometimes tests will fail, for no apparent reason at all. :(
- The first time you run it, it will create a bunch of databases, migrate them and then fail all features spectacularly... Simply quit it after migration is complete and try again.
Written by Sjoerd Tieleman (@tieleman) and Bart Zonneveld (@bartzon), to scratch their own itch. Patches much appreciated.
Something you might also like (but wasn't around when we wrote this): Parallel specs. Takes a slightly different approach.