Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Morrison committed Jan 14, 2010
1 parent a142284 commit 8a0be78
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 574 deletions.
79 changes: 3 additions & 76 deletions README.markdown
Original file line number Original file line Diff line number Diff line change
@@ -1,78 +1,5 @@
Rake tasks to run specs and tests in parallel, to use multiple CPUs and speedup test runtime. You should use:


Setup http://github.com/grosser/parallel_specs
=====


For this fork (to be removed before pulling upstream): because it's awesome! And regularly updated.

script/plugin install git://github.com/jasonm/parallel_specs.git

For the upstream plugin:

script/plugin install git://github.com/grosser/parallel_specs.git

Add <%= ENV['TEST_ENV_NUMBER'] %> to the database name for the test environment in `config/database.yml`,
it is '' for process 1, and '2' for process 2.

test:
adapter: mysql
database: xxx_test<%= ENV['TEST_ENV_NUMBER'] %>
username: root

For each environment, create the databases
mysql -u root -> create database xxx_test2;

Run like hell :D

rake spec:parallel:prepare[2] #db:reset for each database

rake spec:parallel[1] --> 86 seconds
rake spec:parallel --> 47 seconds (default = 2)
rake spec:parallel[4] --> 26 seconds
...

Example output
--------------
2 processes for 210 specs, ~ 105 specs per process
... test output ...

Results:
877 examples, 0 failures, 11 pending
843 examples, 0 failures, 1 pending

Took 29.925333 seconds

Test::Unit
----------

To run Test::Unit tests, use the following task:

rake test:parallel

instead of

rake spec:parallel

This includes the ability to specify more than two parallel environments.

TIPS
====
- `./script/generate rspec` if you are running rspec from gems (this plugin uses script/spec which may fail if rspec files are outdated)
- with zsh this would be `rake "spec:parallel:prepare[3]"`

TODO
====
- find out how many CPUs the user has [here](http://stackoverflow.com/questions/891537/ruby-detect-number-of-cpus-installed)
- grab the 'xxx examples ..' line and display them after all tests have finished

Authors
====
inspired by [pivotal labs](http://pivotallabs.com/users/miked/blog/articles/849-parallelize-your-rspec-suite)

###Contributors
- [Joakim Kolsjö](http://www.rubyblocks.se) -- joakim.kolsjo<$at$>gmail.com
- [Jason Morrison](http://jayunit.net) -- jason.p.morrison<$at$>gmail.com

[Michael Grosser](http://pragmatig.wordpress.com)
grosser.michael@gmail.com
Hereby placed under public domain, do what you want, just do not hold me accountable...
6 changes: 0 additions & 6 deletions Rakefile

This file was deleted.

63 changes: 0 additions & 63 deletions lib/parallel_specs.rb

This file was deleted.

65 changes: 0 additions & 65 deletions lib/parallel_tests.rb

This file was deleted.

129 changes: 0 additions & 129 deletions spec/parallel_specs_spec.rb

This file was deleted.

Loading

2 comments on commit 8a0be78

@grosser
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, will make hopefully installers life easier :)

@grosser
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hopefully <-> make ;)

Please sign in to comment.