Help: Anyone know of a good way to identify slow running Test::Unit tests?
I’ve been digging around for a good technique for identifying slow running tests after reading this article. I’ve been playing with ruby-prof and test timer, but I’m not happy with the results. It looks like this is possible with RSpec, but I can’t find anything for Test::Unit. Help!
Comments
It’s pretty crude, but just running rake with TESTOPTS=”-v” and watching the output can be helpful. rake will display each test’s name as it runs, and you can see which ones are egregiously bad. I’d be also be interested if anyone knows of a better way.
I revamped Geoffrey Grosenbach’s test_benchmark plugin. It works as a rails plug-in or a ruby gem in general. Get it from the github home for test_benchmark and please fork or even just comment with what you would like to see in it.
Zach, thanks for that tip. Tim, this plugin looks great - I’ll check it out right away!
One of my friends has information on how to do it. See details
here.
I just tried Tim Connor’s plugin out - it’s 100% easy to use and awesome. Highly recommended. Thanks!!!
I modified the tobi_test_time plugin (it’s just 1 file actually) that prints only slow tests, to print all of them, and added a bargraph to spot visually the slow one.
see: http://gist.github.com/79077
result:
. 336 2222222 : 2.584 - test_create_an_image_with_some_participations_in_one_go(ImageAdvancedTest) . 340 ++ : 0.173 - test cleanup_user_picture_path() does not translate proper upload path(ImagePathRepairTest) . 341 ++ : 0.135 - test cleanup_user_picture_path() translates tmp upload path(ImagePathRepairTest) . 342 : 0.005 - test shorten_image_url() clears 1 level(ImagePathRepairTest) . 343 1111 : 1.817 - test adding an illustration to a public production should...You should really look at my plugin then, AC. It’s much easier to spot them if you sort. :P
Post a comment