Geeks With Blogs
Mister Goodcat Purrfect software since 1882

Some days ago I added a feature to an existing application, and when I was testing it, I felt that some calculations in the already existing parts of the software were wrong. After digging through the code I found that an external mathematical library is used, which was developed by a colleague some time ago. Due to its nature (being a pretty basic library), it was well-resourced with unit tests, and a short test run showed all of them succeeding. 

I sat down and did some old-school pen and paper calculations, and the results clearly showed that the algorithm in question was way off. I went to see the colleague responsible for the library and it turned out that he found a groundbreaking new technique of creating unit tests that saved him quite some time during the development. Apparently, you just need to follow these three simple rules: 1.) Write a stub for what you want to test. 2.) Debug the (failing) test and... 3.) Put the result of that test run as expected results into the asserts...

Very groundbreaking indeed.

Posted on Tuesday, February 9, 2010 11:28 AM Testing , Worse than failure | Back to top

Comments on this post: Unit test adventures - part 1

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © MisterGoodcat | Powered by: