[LRUG] Large Slow Test Suites

Frederick Cheung frederick.cheung at gmail.com
Thu Dec 5 02:51:12 PST 2013


Sure

https://gist.github.com/fcheung/a7db2482d89e7f35133e

This is rspec-ish but I would thing assume that it can be made to work with anything that allows you to nest contexts with their own setup/teardown blocks

Fred
On 5 Dec 2013, at 10:36, Mr Jaba <the.jaba at gmail.com> wrote:

> Hi Fred, 
> 
> Thanks so much for that, some more interesting ideas there too! I didn't think about setting savepoints seperately to the ones Rails does automatically. I don't suppose you'd be able to gist or paste that snippet so I could see how it works could you? 
> 
> Kind Regards
> 
> Tom
> 
> 
> On 5 December 2013 10:11, Frederick Cheung <frederick.cheung at gmail.com> wrote:
> 
> On 5 Dec 2013, at 09:28, Mr Jaba <the.jaba at gmail.com> wrote:
> 
> > Hi Jon,
> >
> > That's all very useful stuff, thanks very much. Interesting to hear people are going from Fixtures, to Factories and back to Fixtures again! Factories are definitely slow, but I guess as long as your fixtures are managed carefully they're not exactly as evil as they've been made out to be.
> >
> 
> For me it's not that fixtures aren't as evil as they are made out to be, but that factories just aren't any better (+ are slow) as well. I used fixtures for a long time but ended up using factories when I changed jobs and joined a team that had started with factories. At first I thought it was amazing, because I had come from a 5 year old codebase with the fixtures was gnarly and it was hard to maintain them without breaking loads of tests. Now I have a 4 year code base with factories and it's just as hard to change them! The smartness such as running validations, callbacks etc seemed neat at first but quickly gets to be quite irritating and hard to debug.
> 
> The one thing that has made factories semi bearable for me is being able to reuse built objects across multiple specs. For example to test some functionality I want 2 users, 5 garments (and a partridge and a pear tree) we start a savepoint before that set of specs run and create those shared objects. The individual specs still run in their own savepoint, so any database changes are rolled back and when that entire set of specs is done the initial savepoint is rolled back too.
> 
> 
> Fred
> 
> (and another thumbs up for zeus if you're still on spork. Haven't tried spring to be fair)
> 




More information about the Chat mailing list