Test Driven Development has become a well accepted development technique. Although it works well in many places, there are limits where test driven development starts to run into trouble. One of these limits is that you can't always write a testcase because you may not know the correct answer that's supposed to be produced. This may sound strange, but there are some places where the developer doesn't even know the correct answer. They would have to write a program to calculate the answer but that's the program the test is for. I've seen this problem come up with programs that render 3D graphics, simulate physics, or price financial instruments. In all these cases, the calculations needed to get the answer are non-trivial and it's difficult for the developer to do them without a program. Once you have an answer, it's hard to tell that it's the correct one. In cases like this, the only option seems to be to write the test and assert that the answer is something you know is wrong. Once you have the code to produce the correct answer, you change your test to make sure it produces that answer in the future. It's not quite proper test driven development but it can get you over the hurdle.
Download