This post originated from an RSS feed registered with Ruby Buzz
by Daniel Berger.
Original Post: Verbose output by default with Test::Unit 2
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
With test-unit 2.x you can set global configuration options for how your tests run. Global configuration options for test-unit 2 are controlled by your $HOME/.test-unit.yml file.
For example, you can set your runner and verbose output like so:
This is what I do now. I don't like the default output for test-unit because it isn't informative. It's just a bunch of dots. When one fails, you have to sit there and wait for the tests to complete before you can see what failed. This can lead to Testing Rage.
As you can see, instead of waiting for the test suite to complete to determine what test failed, I can see right away that it was the "test_intentional_failure" test that failed. I can also see how long it took to run each test.
This is a superior approach not only because of nicer output, it's a better way to find bad tests. On more than one occasion I've written a test that would hang (blocking IO, infinite loop, whatever), but I couldn't tell which test was hanging with the standard test-unit output. This solves that.
(Warning: test-unit 2.0.9 and earlier had a bug where it was looking for .test-unit.xml by mistake)