[LRUG] Making your tests run fast enough?

James Cumming james.cumming at yahoo.co.uk
Tue Jan 24 02:56:57 PST 2012


I find the same thing with my tests. My request specs and model specs take about 10 - 20 secs, but I have been moving as much of my code to the lib folder and sometimes even to app/extensions folder and testing this with the specs_no_rails approach. 


Anything which interacts directly with active record ( eg validates_presence_of and belongs_to etc), I've left in the model_spec and moved everything else out to the lib directory, which then interacts with active record via api calls etc - and are super easy to stub out and return predefined data for the tests. These take less than a second to run.


cheers



 
James Cumming, CFA, CA(Namibia)
+44 7799 554468


________________________________
 From: Joel Chippindale <joel.chippindale at econsultancy.com>
To: London Ruby Users Group <chat at lists.lrug.org> 
Sent: Tuesday, 24 January 2012, 9:57
Subject: [LRUG]  Making your tests run fast enough?
 

Test speed seems to be a perennial issue for our team.

Currently running a single spec file in our rails (v3.0, running under REE) app takes about 20 seconds and running a single cucumber scenario 30+ seconds. This is too slow for comfortable test driven development/design.

We've recently started using the spec_no_rails pattern (as outlined by Corey Haines here http://www.confreaks.com/videos/641-gogaruco2011-fast-rails-tests) to avoid loading rails, in some of our specs. This has enabled us to run some of our specs in couple of seconds (i.e. fast enough). However this currently only applies to the small subset of our specs that we have isolated from rails. We'd like it if all our tests ran this fast.

How fast are your tests/specs/cucumber? Are they fast enough for you? If they are, what have you done to make this so?

J.

--
Joel Chippindale
CTO - http://econsultancy.com 




_______________________________________________
Chat mailing list
Chat at lists.lrug.org
http://lists.lrug.org/listinfo.cgi/chat-lrug.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20120124/09794ea8/attachment.html>


More information about the Chat mailing list