Expected Result

Invoke a function and ensure that it returns the expected result. Problems:

If you don't know what the result is supposed to be, hopefully there are some sanity checks that can be performed to ensure that the result is at least probably correct. A typical example is ensuring that a message is printed to standard output. It's possible to capture standard output, but it's not reasonable for the testing framework to require that the message printed be exactly the same in all versions of the implementation. However, it is possible to require that if the message is telling some number to the user, that that number appear in the output.

If the result of the function is a complicated object, and it can be specified exactly what that object should be, it seems reasonable to implement that equality test. If the equality problem can't be broken down into smaller fragments, is the design right? DesignForTestability includes the ability to check equality.


EditText of this page (last edited May 3, 1999) or FindPage with title or text search