February 09, 2005 - Failures in Unit Testing

This morning on the Agile Testing mailing list someone pointed out Mike Clark's blog entry "Failures in Unit Testing".

I really like this point Mike made:

I also see unit testing failing in cases where it's a checkbox item on a project schedule. Just saying that we're doing unit testing says nothing about the quality of the tests. So I like to see a test fail once in a while as it tells me that the test is actually testing something that could break.

This stood out to me because it captures two important points, namely that for unit tests to be effective you need more than just lip services, and also the idea that "good tests fail". But a bit oddly given Mike's book I think he missed the (probably related) elephant in the room: "unit testing fails when the tests aren't run".

You would not believe the number of prospects we talk to who say "oh yes, we do unit testing", but then when we get to the POC phase it turns out to have been only dabbling. They had a few people write some tests several months ago, but they haven't been run since and now no longer pass (and perhaps don't even compile).

Why anyone would invest in tests and then not have a system in place to run them automatically is a mystery to me.


Posted by Jeffrey Fredrick at February 9, 2005 10:48 AM


Trackback Pings

TrackBack URL for this entry:
http://www.developertesting.com/mt/mt-tb.cgi/145


Comments

I have a quick question please. I am in a debate with a developer whether this is true or false: If a developer uncovered an error in his code while Unit testing, and then he fixed this error, should he run the unit test all over again (putting into consideration that this uncovered error was a minor defect)? My opinion is that no matter how big or small the defect is, the unit test procedure should be run all over again. Is this true? Kindly help.

Posted by: NGhann on February 28, 2006 03:01 AM

I'm surprised there would be a debate on this point -- how long do your unit tests takes to run? seems like the kind of question that would only come up if the answer was "too long".

But yes, I agree with you, you should run unit tests (at least) as the last step before checking in, after all changes have been made.

Posted by: Jeffrey Fredrick [TypeKey Profile Page] on March 4, 2006 06:49 PM

There should be different team to do Unit testing because reason is simple.If I devlope a product.It is perfect from my point of view.But if someone else see it,he might find out defect in product which i devlope.No product is perfect but we can try to make it perfect from our side.One more thing is that if I am making a product.I will spend most of my time in devloping rather than Unit testing.So I feel there should be some different team for Unit testing to make product robust.

Posted by: sachin on June 13, 2006 06:56 AM

Post a comment




Remember Me?