You might actually be surprised at how many tests are needed. In "The art of software testing" (Myers, 1979) the 1st chapter starts with a quiz.... What tests would you write for a function that takes 3 numbers (the side lengths of a triangle) , and returns whether the triangle is equilateral, scalene or isoceles. I think the answer is over 20.... certainly close on 20 Steve patrick-may / monmouth.com (Patrick May) wrote in message news:<3b3ad3b4.0112061320.38a11953 / posting.google.com>... > > What would the comprehensive test that should be written first look > > like for Calculator sum? > > A more comprehensive test might include type checking on the > variables, etc. Anything that the Customer needs should be tested. > > I like to think of unit testing as a variant of design-by-contract. > Before anything goes into the code base, the test/contract has to be > changed to reflect new expectations. > > It's impossible to test every possible situation -- it's more > important to define your behaviour in terms of tests. If you unit > test before every new bit of code, you will have a comprehensive test > of your expectations. > > This is, of course, much more useful than tests that ensure that the > software works as expected in every possible situation. With the > exception of things like flight avionics, most real world software has > a more limited range of expectations.