Zeus is a tool for speeding up your tests by preloading a Rails app. parallel_tests also speeds up your tests by running them, well, in parallel. Two good gems, so why not to use them together? Let's make our CPUs sweat!
$ time rspec spec
...
Finished in 1 minute 8.34 seconds
916 examples, 0 failures
real 1m21.480s
user 1m4.805s
sys 0m4.516s
$ time rake parallel:spec[8]
Using recorded test runtime
8 processes for 141 specs, ~ 17 specs per process
...
916 examples, 0 failures
Took 46.626499 seconds
real 0m55.790s
user 4m3.065s
sys 0m32.160s
$ time zeus rake parallel:spec[8]
Developer helpers loaded
Using recorded test runtime
8 processes for 141 specs, ~ 17 specs per process
...
916 examples, 0 failures
Took 26.610327 seconds
real 0m28.514s
user 0m0.732s
sys 0m0.061s
Ready to go?
RailsCast episode #413 Fast Tests
Add this line to your application's Gemfile:
gem 'zeus-parallel_tests'
And then execute:
$ bundle
You need also to initialize your project with custom Zeus plan:
$ zeus-parallel_tests init
This will create two files in your project:
- custom_plan.rb
- zeus.json
For RVM users it is recommended to install rubygems-bundler gem.
First follow instructions and prepare your application to use parallel_tests.
Launch another terminal and run zeus' master process:
$ bundle exec zeus start
Then you can run your parallel specs:
$ zeus parallel_rspec spec
or your cucumbers:
$ zeus parallel_cucumber features
- rspec
- cucumber
- guard-rspec since v2.5.2 (just pass
zeus: true
andparallel: true
into configuration hash, you can play withbundler: false
option to speed things up) - caching: you must set
config.cache_store = :memory_store
as Zeus will not reload the various cache files used by parallel_tests instances
- minitest support
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request