Refactor Tests

So let's say you TestFirst for a long time, and you have this problem of MegaExtremeProgrammingAcceptanceTests that take days to tell you anything useful.

Well, we gotta have tests for the TestSuite so we can start to RefactorTests. Happily most TestSuites, courtesy of KentBeck, come with their own tests right out of the box.

First step is not refactoring, but optimizing. We have to profile all our tests and see where they're taking the most time. Then fix any obvious bottlenecks - rewrite in a hard language, use MockObjects instead of live data, that sort of thing.

Next step is making the tests only run when necessary; sure a SmokeTest might take a long time to run, but we don't need to run the whole thing just to work on a small section of the source. Only the tests that build dependencies tell you are relevant should run by default when you're actually working on the codebase.

Finally, if all that doesn't deal with the problem, you're going to have to look for redundancies in the tests themselves and refactor so they're OnceAndOnlyOnce.

If you do all that and you still can't test fast enough to TestFirst, you're going to have to scale the AcceptanceTests back - you're certainly big enough to hire a separate QA group, so bite the bullet and let them worry about it ...


CategoryTesting


EditText of this page (last edited October 13, 2003) or FindPage with title or text search