Skip to content

Instantly share code, notes, and snippets.

@chrismcg
Created April 17, 2009 10:31
Show Gist options
  • Save chrismcg/96960 to your computer and use it in GitHub Desktop.
Save chrismcg/96960 to your computer and use it in GitHub Desktop.
## in test/test_helper.rb
class Test::Unit::TestCase
alias unlogged_run run
def run(result, &block)
RAILS_DEFAULT_LOGGER.debug "RUNNING #{self.class} #{@method_name}"
start_time = Time.now
unlogged_run result, &block
time = Time.now - start_time
RAILS_DEFAULT_LOGGER.debug "TIME;#{self.class}#{@method_name.gsub(/,/, '')};#{time}"
end
end if ENV['PROFILE_LOG']
## in shell config
alias slow_tests="truncate log/test.log && PROFILE_LOG=1 rake && grep TIME log/test.log | cut -d';' -f2- | sort -t';' -n -k2 -r | head -n 20"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment