I want to be able to print a timestamp of the test execution start time. Test::Unit doesn’t seem to be able to do this out-of-the-box, so here’s a monkeypatch I’ve written to put that functionality into-the-box!
class Test::Unit::AutoRunner
alias original_run run
def run
puts "---===[ Starting at #{Time.now} ]===---\n\n"
original_run
end
end
When you run, you’ll see:
---===[ Starting at Thu Aug 13 23:13:24 +0100 2009 ]===---
Loaded suite /Users/nat/dev/add_start_time_to_test_unit
Started
...
Finished in 0.000731 seconds.
3 tests, 3 assertions, 0 failures, 0 errors
Very useful if you are highly iterative in the way you write tests… Are those results on screen from something I ran 2 minutes ago or 30 minutes ago? Well, now you have an easy way to find out!















