As a project gets bigger the tests take longer. There’s no getting around that. So unless you want to abandon testing entirely it might help to see who’s eating all those cpu cycles.
in test/test_helper.rb:
class Test::Unit::TestCase
def run_with_timing(*args, &block)
@timer = Time.now
run_without_timing(*args, &block)
puts "#{Time.now - @timer} - #{self}"
end
alias_method_chain :run, :timing if ENV['TIMER']
end
And run it like so:
$ rake TIMER=true
# or, to see the 10 slowest tests:
$ rake test:units TIMER=true 2>/dev/null | grep " - " | sort -r | head -n 10
And if you really want to air the dirty laundry:
$ grep -R 'def test_truth' test/ | grep -v .svn