Skip to content

Instantly share code, notes, and snippets.

@oleksiilevzhynskyi
Created April 30, 2012 11:57
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save oleksiilevzhynskyi/2557639 to your computer and use it in GitHub Desktop.
Save oleksiilevzhynskyi/2557639 to your computer and use it in GitHub Desktop.
Parallel tests

Parallel tests

test:
  database: yourproject_test<%= ENV['TEST_ENV_NUMBER'] %>
config.action_mailer.delivery_method = :cache
config.action_mailer.cache_settings = { :location => "#{Rails.root}/tmp/cache/action_mailer_cache_delivery#{ENV['TEST_ENV_NUMBER']}.cache" }

Rake task for parallel test

desc "Run tests in parallel mode."
task :parallel, [:cores] do |task, args|
  cores = [args[:cores]]
  Rake::Task["parallel:spec"].invoke(*cores)
  Rake::Task["parallel:features"].invoke(*cores)
end

Tests

bundle exec rake parallel:create
bundle exec rake parallel:prepare
# or
bundle exec rake parallel:create[1]
bundle exec rake parallel:prepare[1]

RSpec

bundle exec rake parallel:spec
# or
bundle exec rake parallel:spec[1]

Cucumber

bundle exec rake parallel:features
# or
bundle exec rake parallel:features[1]

All tests

bundle exec rake parallel
# or
bundle exec rake parallel[1]

Contributors

@iafonov
Copy link

iafonov commented Jul 9, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment