timocratic / test_benchmark

Rails plugin (and/or ruby gem) for benchmarking your test::units: a rework of the original by topfunky

This URL has Read+Write access

name age message
file History.txt Loading commit data...
file Manifest.txt Sun Jun 24 21:41:47 -0700 2007 Updated manifest [Geoffrey Grosenbach]
file README.textile
file Rakefile Sun Jun 24 21:41:47 -0700 2007 Updated manifest [Geoffrey Grosenbach]
file about.yml Thu Sep 21 10:37:11 -0700 2006 First import [Geoffrey Grosenbach]
file init.rb
directory lib/
directory test/ Tue Jan 13 10:57:05 -0800 2009 testing installed gem [timocratic]
file test_benchmark.gemspec
README.textile

Test Benchmark

A ruby gem and rails plugin to show you how slow your Test::Unit tests run. Useful for troubleshooting/isolating slow tests.

Sample output:


  7.124 test_destroy(FeedTest)
  7.219 test_create(FeedTest)
  7.646 test_subscribe_to_auto_discovery(FeedTest)
  9.339 test_auto_discover_updates_url(FeedTest)
  9.543 test_find_or_create_by_auto_discover_url(FeedTest)
  15.780 test_import_from_opml(FeedTest)

Install and enable

As a Rails Plugin

./script/plugin install git://github.com/timocratic/test_benchmark.git

That’s it. It will also work in rails as a gem (optionally frozen), which then you can add to your your environments/test.rb config.gems

As a Ruby gem

  • Update to RubyGems 1.2.0+ before proceeding!!
  • gem sources -a http://gems.github.com (you only have to do this once)
  • sudo gem install timocratic-test_benchmark

Then in your code:

  • require ‘rubygems’
  • require ’test_benchmark

Options and disabling temporarily

By default the top 10 slowest tests are output to the console (and in Rails the whole list is dumped to test.log). To see the full dump in your console (as well as get a per-file/suite breakdown) set the env variable BENCHMARK to ‘full’:

BENCHMARK=full rake test

To disable completely, run with it set to ‘false’ instead.