Concurrent Tests

Posted Over 13 years ago. Visible to the public.

Install gem and plugin

sudo gem install parallel
script/plugin install git://github.com/grosser/parallel_tests.git

Adapt config/database.yml

test:
  database: xxx_test<%= ENV['TEST_ENV_NUMBER'] %>

Create test databases

script/dbconsole -p
CREATE DATABASE `xxx_test2`;
...

Generate RSpec files

script/generate rspec

(you'll probably only let it overwrite files in script/)

Prepare test databases

Now and after each migration:

rake parallel:prepare

Run tests

  • specs: rake parallel:spec
  • features: rake parallel:features

Multiple processes

If you want to test with multiple processes, you need to specify this when preparing the database and running the test, e.g:

rake parallel:prepare[4]
rake parallel:spec[4]

More than twice the amount of courses is probably not sensible, booting up rails takes its time, too.

Last edit
Over 13 years ago
License
Source code in this card is licensed under the MIT License.
Posted by Lexy to makandra dev (2010-08-25 13:16)