Testing exceptions

Keith Stobie, a test architect on the Indigo team has an interesting article on testing exceptions.

Though it is important to verify that the correct exceptions get raised when incorrect data is passed to a function, it is also important to check the state after the exception has happened. What happens when you pass incorrect data, get an exception (which is a expected result for your test), and try to pass correct data - do you still get the exception; if so, you know the method didnt clean its state propertly. Most people miss verifying post-conditions. Verifying that things return to normal can lead to some interesting bugs.

Comments

  • Anonymous
    May 21, 2004
    What kind of inaccuracies? I would be happy to learn.