Run every test in a fork to avoid pollution and get clean output per test. Forks are fast because they preload the test_helper + all fixtures.
Install
gem install forking_test_runner
forking-test-runner test
Running tests test/another_test.rb test/pollution_test.rb test/simple_test.rb
------ >>> test/another_test.rb
Run options: --seed 19151
# Running tests:
.
Finished tests in 0.002904s, 344.3526 tests/s, 344.3526 assertions/s.
1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
------ <<< test/another_test.rb ---- OK
...
Results:
test/another_test.rb: OK
test/pollution_test.rb: OK
test/simple_test.rb: OK
9 assertions, 0 errors, 0 failures, 0 skips, 8 tests
Usage
Run it with individual files
forking-test-runner test/models/user_test.rb test/models/order_test.rb
Simple parallel execution on CI
forking-test-runner test --group 1 --groups 20
Make test groups take the same time
Record test runtime (on your CI, see other modes below)
forking-test-runner test --group 1 --groups 20 --record-runtime amend
Then download the runtime + commit it to your repo + run with runtime
forking-test-runner test --group 1 --groups 20 --runtime-log test/files/runtime.log
Only provide output from failed tests
forking-test-runner test --quiet
RSpec
Just add --rspec
Options
forking-test-runner folder [options]
--rspec RSpec mode
--helper Helper file to load before tests start
--quiet Quiet
--no-fixtures Do not load fixtures
--no-ar Disable ActiveRecord logic
--merge-coverage Merge base code coverage into indvidual files coverage, great for SingleCov
--record-runtime=MODE
Record test runtime:
simple = write to disk at --runtime-log)
amend = write from multiple remote workers via http://github.com/grosser/amend, needs TRAVIS_REPO_SLUG & TRAVIS_BUILD_NUMBER
--runtime-log=FILE File to store runtime log in or runtime.log
--group=NUM What group this is (use with --groups / starts at 1)
--groups=NUM How many groups there are in total (use with --group)
--version Show version
--help Show help
Supported CI Providers
- Travis CI (TRAVIS_REPO_SLUG, TRAVIS_BUILD_NUMBER)
- Buildkite (BUILDKITE_ORGANIZATION_SLUG, BUILDKITE_PIPELINE_SLUG, BUILDKITE_JOB_ID)
Log aggregation
To analyze all builds try this streaming travis log analyzer it will show all failures, the failed files and failed jobs.
Authors
Contributors
Michael Grosser
michael@grosser.it
License: MIT