On Life and Love

Unit testing — staring at a blank screen

For all the brouhaha about unit testing and Test Driven Development, I have yet to find a guide — book, website, anything — that actually discusses how to write unit tests.

There are nUnit-specific articles that talk about the foibles of each and how to have testing run constantly and so on and so forth, but how do I know how to compose a unit test? How low-level and nitty-gritty do tests need to be so that they’re useful without making me want to stab myself in the eye from maintenance? What’s the best way to test controllers vs. models?

Maybe I’m just not cool enough with Uncle Google to find what I’m looking for, and I certainly don’t mind experimentation, but I’d be interested in hearing how the “experts” approach TDD.

2 Comments

  • guyblade

    I believe the standard answer to this is that every function should have such tests as to verify the common case (several here) and each corner case. So yeah, good luck with that.