[rspec-users] Spec/Test Speed

Chad Humphries chad at spicycode.com
Sun Oct 7 00:31:46 EDT 2007


I don't really have a lot to contribute on how to make it faster,  
other than to outline what we've been doing on our projects.

On one of our current projects we have the following 2570 examples  
that run in ~70 seconds on our pairing stations (mac minis, 1.83  
c2d).  In general across our various machines is at or a little more  
than a minute for specs for controllers, models, helpers, lib, views,  
and plugins.   Our Story suite takes longer, but it's still under  
development so I don't really count it at this point.   We have Ruby  
1.8.6 installed from MacPorts on all machines, as well as MySQL 5. 
(current as of a month ago) from macports.

We make good use of mocking and stubbing through our controller  
tests, and little use of fixtures.  We primarily use the  
spec_attribute_helper (or factory method) as Luke Redpath and Dan  
Manges have outlined in their respective blog articles.     I've been  
looking at deep test, or possible spec_distributed as a way to speed  
things up more.   Our main issue is our precommit task (rake cruise  
which our ci server also runs) executes rcov to test for full  
coverage and adds 15-25 seconds to the whole thing bringing it up to  
a minute and a half.

We also make heavy use of some simple custom rcov tasks ala rake  
app:coverage:models, rake app:coverage:lib, etc to help when we are  
working on slices of the apps.   So far we have found that regardless  
of the wait (and the increased chances of wandering about to other  
tasks) we always want to run the full stack locally and not just a  

Then again all this strikes me as rather funny as I remember waiting  
5 or 6 minutes back in my .NET days for a quarter our tests to run,  
with no coverage report.  I guess ruby and rspec spoiled me :)

- Chad

NOTE: Our project is on EdgeRails (few revisions back) and Trunk RSpec

On Oct 6, 2007, at 11:16 PM, Scott Taylor wrote:

> On Oct 4, 2007, at 6:11 AM, Jerry West wrote:
>> In-memory with sqlite worked fine with rspec-0.8 (it's been a while
>> since I did this!).  Google for instructions or drop me a line.   
>> Don't
>> forget autotest/zentest to run only those tests which have ben
>> affected
>> by changes.
> Actually, on my current rails project I can't use sqlite, because of
> a bug in rails:
> http://dev.rubyonrails.org/ticket/9385
> So out goes that idea (at least for the forseeable future).  What
> speed difference do you see with in-memory database?
> I'm already using ZenTest.  When going from red -> (subset) green =>
> (all) green, the last step is killing me (because I have to wait
> around for 2 minutes for all the specs to fail.  This usually results
> in me spending a lot of time responding to emails while I should be
> developing ;)
> Scott
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list