Giter Club home page Giter Club logo

parallel_split_test's Introduction

Split a big test file into multiple chunks and run them in parallel

Install

gem install parallel_split_test

Usage

1: prepare your databases

To use 1 database per test-process, add this to your config/database.yml

test:
  database: yourproject_test<%= ENV['TEST_ENV_NUMBER'] %>
  • TEST_ENV_NUMBER is '' for the first process and 2 for the 2nd, it reuses your normal test database
  • Optionally install parallel_tests to get database helper tasks like rake parallel:prepare

2: find a slow/big test file

# spec/xxx_spec.rb
require "spec_helper"

describe "X" do
  it {sleep 5}
  it {sleep 5}
  it {sleep 5}
end

3: run

parallel_split_test spec/xxx_spec.rb [regular test options]

Output

parallel_split_test spec/xx_spec.rb

Running examples in 2 processes
.

Finished in 5 seconds
1 example, 0 failures
..

Finished in 1 seconds
2 examples, 0 failures

Summary:
1 example, 0 failures
2 examples, 0 failures
Took 10.06 seconds with 2 processes

TIPS

  • use -o/--out to get unified/clean output from all processes
  • set number of processes to use with PARALLEL_SPLIT_TEST_PROCESSES environment variable
  • unify JUnit output for rspec

TODO

  • Cucumber support
  • Test::Unit / Minitest support

Authors

Michael Grosser
[email protected]
License: MIT
Build Status

parallel_split_test's People

Contributors

bootstraponline avatar grosser 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.