-
-
Save rsl/6071807 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test::Unit::TestCase # Or ActiveSupport::TestCase if you are using Rails | |
# This is a debugging utility to find slow tests. | |
# Usage: rake FIND_SLOW_TESTS=true test:units | |
unless ENV["FIND_SLOW_TESTS"].blank? | |
alias_method :old_run, :run | |
def run(*args, &block) | |
start_time = Time.now | |
old_run *args, &block | |
test_time = Time.now - start_time | |
puts "\nSLOW TEST: #{self.name}, #{test_time}s" if test_time > 0.5 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment