How to write a unit test

Jason Diamond comments on Brad Wilson's post about unit tests' SetUp and TearDown methods. In the process, he lists some excellent general guidelines on how to structure your unit tests and fixtures. Definitely worth a read. Jason concludes:

These days, I write a lot more fixtures. Each fixture has a unique SetUp method and the test cases usually contain nothing more than a single method call and one or two assertions. To figure out what the entire test case does, all I have to do is look at the SetUp method which, itself, is usually just a few lines of code. Getting to this point was initially pretty difficult but it’s gotten easier over time.

posted @ Sunday, December 4, 2005 11:36 PM

Comments have been closed on this topic.