Top 12 Reasons to Write Unit Tests
Subject:   Testing is a wrong way ...
Date:   2003-04-29 05:55:06
From:   anonymous2
Response to: Testing is a wrong way ...

Yes, it's true that testing does not guarantee perfect code; yet it does provide a marginal benefit ("marginal" meaning that you spend a little bit of effort testing, and you get a little bit of benefit in return). And a marginal benefit is definitely worth something!

Unfortunately, the word "test" does suggest perfection to me... I wish for a better word, that conveys the idea of marginal benefit.

For some reason, when I write test code, it's very easy for me to fall into the trap of trying to make it perfect. Perhaps this is because of the problem of "false alarms" - that is, your test code has a bug in it, which makes it think your app code has a bug in it, when it doesn't really have a bug in it.

If you test code is imperfect in this particular way, it can really waste a lot of time.

BTW: While testing is obviously central to the XP canon, it doesn't seem to follow the same philophy, because of the need for perfection in this sense; and because you cannot write tests in an XP way (ie they have to work correctly and completely for them to be any use).