[LRUG] Large Slow Test Suites

Mr Jaba the.jaba at gmail.com
Wed Dec 4 14:56:38 PST 2013


Hi Jon,

First up, thanks for Spring (amongst your many other contributions!) it's a
really useful gem!

I believe your first question is one I need to find the answer to. I'm
unsure as to the root cause of the slowness although as you suspect there
are many factories being used so I think this is going to be a huge problem
although a difficult one to solve as there are so many!

There are quite a few functional/ "integration" tests, none of which I've
seen so far using capybara. I think splitting the tests up is a good plan,
we're using Guard so we do get fast-ish feedback but ideally I'd like the
whole suite to run in < 10 minutes. The limit on the drone.io CI server is
15 minutes so the first job is to get it to run on there!

With regards to the factories, what do you recommend instead? Simpler
objects with less coupling to Rails?

Thanks for your input!

Tom


On 4 December 2013 22:43, Jon Leighton <j at jonathanleighton.com> wrote:

> Hello there,
>
> On 04/12/13 22:20, Mr Jaba wrote:
> > I've recently taken ownership of a new project with a large test suite
> > (2000ish tests), and the overall run time is around 30 minutes which is
> > certainly less than ideal!
> >
> > Now I know the general approach to "Fast Rails Tests" but taking the
> > time to refactor the whole test suite is a bit too much right now. I'm
> > wondering if anyone has experience of transforming a test suite of this
> > magnitude to something a bit speedier? If so how did you go about it?
> > What tips, tricks and techniques can you share?
> >
> > A bit more info:
> >
> > - Test::Unit tests, moving to Minitest
> > - Rails 3.2.16
> > - Running parallel_tests shaved 5 mins off the time
> > - Using Spring to reduce Rails load time.
> >
> > Any advice gratefully received!
>
> I think you need to provide some more information :) What's making it
> take so long - the sheer number of tests or what the tests are doing? Do
> you have certain types of tests that are taking a large portion of the
> time (e.g. Capybara tests?) Are you using factories? In my experience
> factories are an easy cause of a slow test suite.
>
> One thing to think about is whether you can break up your test suite.
> For example in the application I work on, we have unit/integration tests
> which run in about 25 seconds on my machine. I frequently run these
> during development and they often alert me to problems. But I rarely run
> the full set of capybara tests which takes several minutes - I let the
> CI do that and run failing tests individually where necessary. This
> achieves a decent balance of fast feedback for development without
> throwing away the safety net of proper full-stack tests.
>
> Jon
> _______________________________________________
> 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/20131204/dabf8cd9/attachment.html>


More information about the Chat mailing list