Fixtures can be annotated with @FailFast
to stop further
processing if any exception is encountered. (More details)
However, it can be useful to fail-fast on some exceptions but not others.
The @FailFast
annotation can be supplied with a list of
exception types. In this case, processing will only be stopped if an exception
is encountered that is an instance of one of the exception types in the list.
When the fixture is annotated with @FailFast(onExceptionType={RuntimeException.class, IOException.class})
and processes the following:
<p concordion:execute="myTimeoutExceptionThrower()"> This method throws a TimeoutException (which is not a subclass of RuntimeException or IOException). </p> <p concordion:execute="myMethod()"> This method executes quietly. </p>
It calls
myMethod()
in the Java fixture code because the TimeoutException
thrown by the
first method call does not stop further processing of the test.
When the fixture is annotated with @FailFast(onExceptionType={RuntimeException.class, IOException.class})
and processes the following:
<p concordion:execute="myFileNotFoundExceptionThrower()"> This method throws a FileNotFoundException (which is a subclass of IOException). </p> <p concordion:execute="myMethod()"> This method executes quietly. </p>
It does not call
myMethod()
in the Java fixture code because the FileNotFoundException
thrown by the
first method call stops further processing of the test.