Giter VIP home page Giter VIP logo

parallel_test's Introduction

Rake tasks to run tests in parallel, to use multiple CPUs and speedup test runtime.

Based heavily on on http://github.com/grosser/parallel_specs/; i.e. this is a copy of parallel_spec with a handful of changes to run test/**/*_test.rb instead of specs.

Setup

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

Copy your test environment inside config/database.yml once for every cpu you got ('test'+number).

test:
  adapter: mysql
  database: xxx_test
  username: root

test2:
  adapter: mysql
  database: xxx_test2
  username: root

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

Run like hell :D

(Make sure your `test/test_helper.rb` does not set `ENV['RAILS_ENV']` to 'test')

rake test:parallel:prepare[2] #db:reset for each env

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

Example output

running tests in 2 processes
93 tests per process
starting process 1
starting process 2
... test output ...
Took 47.319378 seconds

TODO

  • find out how many CPUs the user has
  • sync the output, so that results do not appear all at once
  • grab the 'xxx examples ..' line and display them at the bottom
  • find a less hacky approach (without manual creation so many envs)

Author

inspired by pivotal labs
Michael Grosser
[email protected]
Hereby placed under public domain, do what you want, just do not hold me accountable...

parallel_test's People

Contributors

edavis10 avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.