Have you ever been annoyed that when you run tests, you only see periods, E’s and F’s; not being able to see what actually went wrong until all the tests were done?
I found this pretty gem last week, thanks to some nice people in #rubyonrails. It’s called Turn, and I am unable to find a repository for it anywhere. What it does, is update your test output as follows:
Loaded suite /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader Started ........ Finished in 0.339899 seconds. 8 tests, 8 assertions, 0 failures, 0 errors
Loaded suite /usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/rake_test_loader CourseInstanceTest test_truth PASS CourseTest test_truth PASS # some output removed here ============================================================================== pass: 8, fail: 0, error: 0 total: 8 tests with 8 assertions in 0.373991 seconds ==============================================================================
This way, you will be notified which tests fail right after it fails, which can save considerable time; you will be able to start fixing it before your test suite is finished (which can take quite some time I’ve noticed). As an added bonus, if you have the ‘facets‘ gem installed, it will even colorize the output.
I’ve made a small modification to the gem which allows you to specify whether or not you want to hide passed tests, since this produces quite a lot more output than the default Test::Unit output. However, I don’t have access to this modification right now, I’ll add it later.
gem install turn
Add this to your test/test_helper.rb:
begin require 'turn' rescue LoadError puts 'Install the Turn gem for prettier test output.' end