Patterns of XUnit Test Automation is a good resource for developers doing TDD. From the site:
This site has been put together to allow the XUnit community to share good practices in test automation. It came about as a result of discussions between Gerard Meszaros and Shaun Smith about the testing techniques we find ourselves using over and over again to solve particular XUnit test automation problems.
Why is Test Automation Important?
Automated unit tests (A.K.A. "developer tests") and functional tests (A.K.A. "customer tests") are a cornerstone of many agile development methods (such as eXtreme Programming). The availability of automated, self-checking tests allows developers to be much bolder in how they modify existing software. They allow a more evolutionary form of software development that support incremental delivery of functionality to the customer (motto: Deliver early; deliver often!) that speeds up user feedback and improves the quality (both "fitness for purpose" and "software quality") of the software being built. The techniques are also spreading to less agile development methods via the introduction of "Test Driven Development" as a less extreme process alternative.
Why is Test Automation Hard?
Cost effective test automation is all about repeatability, maintainability and communication. Repeatability of results requires repeatability of test fixture setup and repeatability of the interactions with the software under test. And that requires interfaces into the software under test that allow you to put it in the right state before the test and to find out what state it is in after the test. And that can be hard. Throw in the need to make the tests easy to understand and easy to maintain and the problem gets even harder.
Why Test Automation *Patterns*?
We have been reading the various conference papers and (mostly JUnit-based) books on test automation for quite some time. Each author seems to have a particular area of interest and favorite techniques. While we don't always agree with their practices, we are always trying to understand why they do it a particular way and *when* it would be more appropriate to use their techniques than the ones we already use.