RSpeed
RSpeed splits your specs to you run parallels tests.
Install
Add the following code on your Gemfile and run bundle install:
gem 'rspeed'Setup
We need to extract the rake that executes the split via rspeed:run.
rake rspeed:installUsage
-
RSPEED_APP: You app name to avoid data override -
RSPEED_PIPE: Current pipe -
RSPEED_PIPES: Quantity of pipes -
RSPEED_SPEC_PATH: The specs folders path -
RSPEED: Enables RSpeed
RSPEED=true RSPEED_APP=blog RSPEED_PIPE=1 RSPEED_PIPES=3 bundle exec rake rspeed:runHow it Works
First run
- Since we have no statistics on the first time, we run all specs and collect it;
{ "file": "./spec/models/1_spec.rb", "time": 0.01 }
{ "file": "./spec/models/2_spec.rb", "time": 0.02 }
{ "file": "./spec/models/3_spec.rb", "time": 0.001 }
{ "file": "./spec/models/4_spec.rb", "time": 1 }Second and next runs
- Previous statistics is balanced by times and distributed between pipes:
{ "file": "./spec/models/4_spec.rb", "time": 1 }{ "file": "./spec/models/2_spec.rb", "time": 0.02 }{ "file": "./spec/models/3_spec.rb", "time": 0.001 }
{ "file": "./spec/models/1_spec.rb", "time": 0.01 }- Run the current pipe
1:
{ "file": "./spec/models/4_spec.rb", "time": 1 }- Collects statistics and temporary save it;
- Run the current pipe
2:
{ "file": "./spec/models/2_spec.rb", "time": 0.02 }- Collects statistics and temporary save it;
- Run the current pipe
3:
{ "file": "./spec/models/3_spec.rb", "time": 0.001 }
{ "file": "./spec/models/1_spec.rb", "time": 0.01 }- Collects statistics and temporary save it;
- Sum all the last statistics and save it for the next run;