Readme.md in parallel_tests-0.7.0.alpha vs Readme.md in parallel_tests-0.7.0.alpha2
- old
+ new
@@ -1,12 +1,13 @@
Speedup Test::Unit + RSpec + Cucumber by running parallel on multiple CPUs (or cores).<br/>
ParallelTests splits tests into even groups(by number of tests or runtime) and runs each group in a single process with its own database.
Setup for Rails
===============
+[still using Rails 2?](https://github.com/grosser/parallel_tests/blob/master/ReadmeRails2.md)
+
## Install
-### Rails 3
If you use RSpec: ensure you got >= 2.4
As gem
# add to Gemfile
@@ -17,32 +18,10 @@
rails plugin install git://github.com/grosser/parallel_tests.git
# add to Gemfile
gem "parallel", :group => :development
-
-### Rails 2
-
-As gem
-
- gem install parallel_tests
-
- # add to config/environments/development.rb
- config.gem "parallel_tests"
-
- # add to Rakefile
- begin; require 'parallel_tests/tasks'; rescue LoadError; end
-
-OR as plugin
-
- gem install parallel
-
- # add to config/environments/development.rb
- config.gem "parallel"
-
- ./script/plugin install git://github.com/grosser/parallel_tests.git
-
## Setup
ParallelTests uses 1 database per test-process, 2 processes will use `*_test` and `*_test2`.
### 1: Add to `config/database.yml`
@@ -89,35 +68,28 @@
Log test runtime to give each process the same runtime.
Rspec: Add to your `.rspec_parallel` (or `.rspec`) :
- RSpec 1.x:
- --format progress
- --require parallel_tests/spec/runtime_logger
- --format ParallelTests::Spec::RuntimeLogger:tmp/parallel_profile.log
- RSpec >= 2.4:
+ RSpec
If installed as plugin: -I vendor/plugins/parallel_tests/lib
--format progress
--format ParallelTests::Spec::RuntimeLogger --out tmp/parallel_profile.log
Test::Unit: Add to your `test_helper.rb`:
- require 'parallel_tests/runtime_logger'
+ require 'parallel_tests/test/runtime_logger'
+
SpecSummaryLogger
--------------------
This logger logs the test output without the different processes overwriting each other.
Add the following to your `.rspec_parallel` (or `.rspec`) :
- RSpec 1.x:
- --format progress
- --require parallel_tests/spec/summary_logger
- --format ParallelTests::Spec::SummaryLogger:tmp/spec_summary.log
- RSpec >= 2.2:
+ RSpec:
If installed as plugin: -I vendor/plugins/parallel_tests/lib
--format progress
--format ParallelTests::Spec::SummaryLogger --out tmp/spec_summary.log
SpecFailuresLogger
@@ -129,45 +101,42 @@
rspec /path/to/my_spec.rb:123 # should do something
Add the following to your `.rspec_parallel` (or `.rspec`) :
- RSpec 1.x:
- --format progress
- --require parallel_tests/spec/failures_logger
- --format ParallelTests::Spec::FailuresLogger:tmp/failing_specs.log
- RSpec >= 2.4:
+ RSpec:
If installed as plugin: -I vendor/plugins/parallel_tests/lib
--format progress
--format ParallelTests::Spec::FailuresLogger --out tmp/failing_specs.log
Setup for non-rails
===================
- sudo gem install parallel_tests
+ gem install parallel_tests
# go to your project dir
- parallel_test OR parallel_spec OR parallel_cucumber
- # [Optional] use ENV['TEST_ENV_NUMBER'] inside your tests to select separate db/memcache/etc.
+ parallel_test test/
+ parallel_spec spec/
+ parallel_cucumber features/
-[optional] Only run selected files & folders:
+ - use ENV['TEST_ENV_NUMBER'] inside your tests to select separate db/memcache/etc.
+ - Only run selected files & folders:
parallel_test test/bar test/baz/foo_text.rb
Options are:
-n [PROCESSES] How many processes to use, default: available CPUs
-p, --path [PATH] run tests inside this path only
--no-sort do not sort files before running them
-m, --multiply-processes [FLOAT] use given number as a multiplier of processes to run
- -r, --root [PATH] execute test commands from this path
-e, --exec [COMMAND] execute this code parallel and with ENV['TEST_ENV_NUM']
-o, --test-options '[OPTIONS]' execute test commands with those options
- -t, --type [TYPE] which type of tests to run? test, spec or features
+ -t, --type [TYPE] test(default) / spec / cucumber
--non-parallel execute same commands but do not in parallel, needs --exec
-v, --version Show Version
-h, --help Show this.
-You can run any kind of code with -e / --execute
+You can run any kind of code in parallel with -e / --execute
parallel_test -n 5 -e 'ruby -e "puts %[hello from process #{ENV[:TEST_ENV_NUMBER.to_s].inspect}]"'
hello from process "2"
hello from process ""
hello from process "3"
@@ -181,28 +150,26 @@
</table>
TIPS
====
- [Capybara + Selenium] add to env.rb: `Capybara.server_port = 8888 + ENV['TEST_ENV_NUMBER'].to_i`
- - [RSpec] add a `spec/parallel_spec.opts` to use different options, e.g. no --drb (default: `spec/spec.opts`)
- - [RSpec] if something looks fishy try to delete `script/spec`
- - [RSpec] if `script/spec` is missing parallel:spec uses just `spec` (which solves some issues with double-loaded environment.rb)
- - [RSpec] 'script/spec_server' or [spork](http://github.com/timcharper/spork/tree/master) do not work in parallel
- - [RSpec] `./script/generate rspec` if you are running rspec from gems (this plugin uses script/spec which may fail if rspec files are outdated)
+ - [RSpec] add a `.rspec_parallel` to use different options, e.g. **no --drb**
+ - [RSpec] delete `script/spec`
+ - [RSpec] [spork](https://github.com/timcharper/spork) does not work in parallel
- [RSpec] remove --loadby from you spec/*.opts
- [Bundler] if you have a `Gemfile` then `bundle exec` will be used to run tests
- [Capybara setup](https://github.com/grosser/parallel_tests/wiki)
- [Sphinx setup](https://github.com/grosser/parallel_tests/wiki)
- [Capistrano setup](https://github.com/grosser/parallel_tests/wiki/Remotely-with-capistrano) let your tests run on a big box instead of your laptop
- [SQL schema format] use :ruby schema format to get faster parallel:prepare`
- [ActiveRecord] if you do not have `db:abort_if_pending_migrations` add this to your Rakefile: `task('db:abort_if_pending_migrations'){}`
- `export PARALLEL_TEST_PROCESSORS=X` in your environment and parallel_tests will use this number of processors by default
- - with zsh this would be `rake "parallel:prepare[3]"`
+ - [ZSH] use quotes to use rake arguments `rake "parallel:prepare[3]"`
TODO
====
- - move everything Rails 2 related to a e.g. Rails2Readme.md and link it
+ - document how to use cucumber runtime logger
- unify runtime-log location
- add tests for cucumber runtime formatter
- make jRuby compatible [basics](http://yehudakatz.com/2009/07/01/new-rails-isolation-testing/)
- make windows compatible
@@ -238,7 +205,6 @@
- [Sean Walbran](https://github.com/seanwalbran)
- [Lawrence Wang](https://github.com/levity)
[Michael Grosser](http://grosser.it)<br/>
michael@grosser.it<br/>
-Hereby placed under public domain, do what you want, just do not hold me accountable...<br/>
-[![Flattr](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=grosser&url=https://github.com/grosser/parallel_tests&title=parallel_tests&language=en_GB&tags=github&category=software)
+License: MIT