[LRUG] Large Slow Test Suites
Jon Leighton
j at jonathanleighton.com
Wed Dec 4 14:43:54 PST 2013
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
More information about the Chat
mailing list