FlyOrDie is a simple plugin for Minitest that allows you to specify via command-line options a maximum duration for a test to be marked as "slow", and a maximum number of allowable slow tests.
If the thresholds are exceeded, the test run will be marked as failed and the list of slow tests will be output.
FlyOrDie is primarily meant to be used as part of a Continuous Integration (CI) process to ensure test quality, sometimes referred to as a 'test ratchet'.
Add this line to your application's Gemfile:
gem "minitest-flyordie"
gem 'minitest-flyordie'
And then execute:
$ bundle
Use the --maxslow=COUNT
flag to set the maximum allowed number of slow tests.
Use the --slowtime=DURATION
flag to specify the duration for a tests to be slow, in milliseconds.
Direct invocation:
`ruby test_thing.rb --maxslow=3 --slowtime=30`
Via rake test runner:
`TESTOPTS='--maxslow=4 --slowtime=42' rake test`
Based on ideas from Step and Nick. And code liberally copied from Nick's minitest-profile gem.
- Fork it ( https://github.com/[my-github-username]/minitest-flyordie/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request