[LRUG] Making your tests run fast enough?

nicolas alpi nicolas.alpi at gmail.com
Tue Jan 24 03:21:24 PST 2012


On the app I'm working on at the moment the tests used to take more than 40
minutes to pass on my machine, and after a week of experimenting with
different techniques we went down to 8 minutes in normal mode and around 4
minutes using parallel tests.

If has been a combination of:

Fast_context in shoulda
Mocking/Stubbing all the non used after_save that are time consuming
Created a skip_mock helper when you need that will skip those after save
based on Models
Implementing idea found around here
http://37signals.com/svn/posts/2742-the-road-to-faster-tests
And one of the most convenient way to find slower tests was to look at
generated diagrams with https://github.com/tmm1/perftools.rb

Once all this was done we went from near 40minutes to sub 10 minutes, then
we've investigate in parallel tests
https://github.com/grosser/parallel_tests

And it's now a pleasure to pass the tests :)

my 2 cents
--
Nicolas Alpi, web developer, cookies eater
http://www.wealsodocookies.com


On Tue, Jan 24, 2012 at 11:04 AM, Ian Leitch <port001 at gmail.com> wrote:

> Also, for anyone using 1.9.3, this patch gave me a 44% (!!!)
> improvement in loading my environment.
>
> https://gist.github.com/1658360
>
> On 24 January 2012 11:03, Andrew Stewart <boss at airbladesoftware.com>
> wrote:
> >
> > On 24 Jan 2012, at 12:01, Jonathan del Strother wrote:
> >
> >> It is kinda a micro-optimization though - the idea of
> >> decoupling rails from our tests is very appealing.
> >
> > Here are three more micro-optimisations which might help a little
> (though not a lot):
> >
> >
> http://blog.plataformatec.com.br/2011/12/three-tips-to-improve-the-performance-of-your-test-suite
> >
> > Cheers,
> > Andy
> > -------
> > http://airbladesoftware.com
> >
> >
> > _______________________________________________
> > Chat mailing list
> > Chat at lists.lrug.org
> > http://lists.lrug.org/listinfo.cgi/chat-lrug.org
> _______________________________________________
> 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/4e19b2c8/attachment-0003.html>


More information about the Chat mailing list