I''m a new (and complete) convert to RSpec, especially when coupled with autotest. I notice when automate processes my entire spec directory it takes about eight minutes. I have many more tests to add before I''m done, so eventually I''ll want to streamline my tests. Is there a quick and dirty way log the amount of time spent on each file to a log? That would give me a place to start looking for optimizations. (For extra credit: is there a way to log the time spent on each individual test?) I''ll look into using before(:all) and after(:all) for doing this, but if you''ve already created a benchmark hook for rspec, I''m happy to use your code. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110209/97e8fa67/attachment.html>
David Chelimsky
2011-Feb-12 20:59 UTC
[rspec-users] using before(:all) for cheap benchmark?
On Feb 9, 2011, at 9:36 PM, Robert Poor wrote:> I''m a new (and complete) convert to RSpec, especially when coupled with autotest. > > I notice when automate processes my entire spec directory it takes about eight minutes. I have many more tests to add before I''m done, so eventually I''ll want to streamline my tests. > > Is there a quick and dirty way log the amount of time spent on each file to a log? That would give me a place to start looking for optimizations. (For extra credit: is there a way to log the time spent on each individual test?) > > I''ll look into using before(:all) and after(:all) for doing this, but if you''ve already created a benchmark hook for rspec, I''m happy to use your code.Run the rspec command with the --help flag, like this: rspec --help It lists all of the available options, including --profile, which lists the 10 slowest examples. Doesn''t give you exactly what you''re saying you want, but it probably sets you in the right direction. HTH, David