How to Compare the Rails 3 Test Suite

I want to optimize the test suite. First I need to know where the time is being spent. At a minimum, I want to know how much time is spent on each test.

I came across this gem https://github.com/timocratic/test_benchmark , but is no longer supported.

Please note that my goal is to compare the test suite, not the application.

Is there any other stone that I could use?

  • Rails
  • Rspec
  • Capybara
+7
source share
2 answers

Rspec includes a minimum functional profiler. Have you looked at him? ( blogging tutorial for rspec1 but still valid for rspec2 )

Basically, if you specify -p , then you will get a list of the slowest 10 tests.

+8
source

Are you familiar with the unix time command? If you just want to see how long your test suite has been running, you can simply add a time command:

 time rake spec 

After rspec exits, you should see something like

 Finished in 5.31 seconds 195 examples, 0 failures, 27 pending real 0m26.580s user 0m14.085s sys 0m2.168s 

Of course, it is assumed that you are on the * nix platform :-)

-a

+4
source

All Articles