Fivemat
Why settle for a test output format when you can have a test output
fivemat?
I’m tired of the two de facto standards for test output:
- Bunch of dots — Wait till the end to see what failed, and guess the dot count to estimate progress.
- Extreme verbosity — See failures as they happen if you pay very, very close attention.
In other words, you can choose between “too little” or “too much.”
I’ve looked at third party alternatives, but none of them did much for
me. What I want is the middle ground: dots grouped by file. Thus,
I give you Fivemat:
DoohickeyTest ….
KajiggerTest …………………….F………..
1) Failure:
test_isnt_actually_nil(KajiggerTest) [test/kajigger_test.rb:17]:
Expected nil to not be nil.
WhatchamacallitTest …………………………………………
WidgetTest …E……
2) Error:
ZeroDivisionError: divided by 0
test/widget_test.rb:20:in /'
test_dividing_by_1’
test/widget_test.rb:20:in
MiniTest, RSpec, and Cucumber are supported. Here, have some sample
Cucumber output:
features/sign_in.feature ……F–……..
no button with value or id or text ‘Go’ found (Capybara::ElementNotFound)
./features/step_definitions/web_steps.rb:53:in /^I press "([^"]*)"$/'
When I press “Log In”‘
./features/sign_in.feature:10:in
features/sign_out.feature …….
features/sign_up.feature ………………………………………..
Usage
Start by adding gem 'fivemat'
to your Gemfile
.
MiniTest
Change require 'minitest/autorun'
to require 'fivemat/minitest/autorun'
.
RSpec
Add --format Fivemat
to .rspec
.
Cucumber
Add --format Fivemat
to cucumber.yml
.
Contributing
Don’t forget to include test coverage for any changes you introduce.
(Ha! I kid! Everybody knows it’s impossible to test a test library.)
License
Copyright © Tim Pope. MIT License.