Throwable
, Exception
, or
Error
?Ideally, only specific, anticipated exceptions should be caught by a test. Any other exception which is provoked during testing should be propagated back to the harness.
In the event that a very general exception is caught in test code, a certain
amount of care will need to be exercised. For example if a user wants to stop
the harness during a test run, an InterruptedException
is used to
interrupt the test. If that exception is caught by a test and not re-thrown to
the harness, the stop request will be lost and the tests will not stop!
Here is a list of exceptions that may need to be re-thrown:
InterruptedException
(from Exception
)InterruptedIOException
(from IOException
)ThreadDeath
(from Error
)