A large chunk of unit testing is making sure that your code is invulnerable to bad data. So if you pass in invalid data, the code should detect it and pass back an "invalid" flagged result. Negative tests are actually easier to write than positive tests; you just need to walk the code from top to bottom and look for things that will destroy you. NULL pointers as input are always good. (Or is that bad? :) )
The positive tests are more difficult, but if you can build a spreadsheet that replicates a simple calculation, you can demonstrate that you get the same answer as the Excel emulation.
no subject
Date: 2011-09-05 03:57 am (UTC)The positive tests are more difficult, but if you can build a spreadsheet that replicates a simple calculation, you can demonstrate that you get the same answer as the Excel emulation.