so, after googling (oh, this google-ing form passes the checkspell ! ) site:github.com, i found test_benchmark. it is super easy to setup.
Include Gem and Rake
if you are using Rails 3, just
- add following line to Gemfile (better put it in group :test):
gem "test_benchmark"
- run:
bundle install
- run:
(or rake test:units if you want to find slow model test cases)bundle install
then you can see the top 15 slowest test cases:
Turn it off
you dont want to see all this figures every time you rake test. to switch it off, provide
rake test BENCHMARK=false
Turn it off by default
this is cool gem and some options available to configure.
but actually, i want the other way round.
I want it off by default and turn it on ad-hoc
so i added one line in my test_helper.rb:
Test::Unit::UI::Console::TestRunner.set_test_benchmark_limits(0, 0) unless ENV["SHOW_TIME"]
so now the usage becomes
rake test SHOW_TIME=true
there are some more options there, check out the details at timocratic github:
https://github.com/timocratic/test_benchmark
No comments:
Post a Comment