[LRUG] Large Slow Test Suites
Frederick Cheung
frederick.cheung at gmail.com
Thu Dec 5 02:11:38 PST 2013
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