Good Unit Test Qualities

posted on 2005-05-19 at 22:42:46 by Joel Ross

Jeremy Miller has another good post about what constitutes quality unit tests.

He says one thing that I've seen debated elsewhere. Unit tests should be order independent. Steven Smith has a post arguing that a unit test relying on another one might not be so bad. At first I was skeptical for the same reasons Jeremy lists - mainly relying on "dirty data" but if you read Steven's post, you'll find that's not why he wants test dependency. His example shows what he's talking about. If your unit test that connects to a database fails, what's the point of running all of the tests that rely on that connection?

I think both points are valid, but I don't think we'll see it in Nunit any time soon. The Nunit purists will fight it because of the possibility for abuse. Personally, I think you make the tools powerful enough to do what needs to be done, and if people abuse them, then that's their problem.

Categories: Development