transcendental-lisp/fitnesse/FitNesseRoot/FitNesse/UserGuide/WritingAcceptanceTests/SliM/ExceptionHandling/content.txt

10 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

!2 Default Handling of exceptions.
The default way Slim handles exceptions is to indicate in the test table that an exception was thrown, and increment the exceptions count for the test. You will also find the full stack trace for the exception is listed at the top of the test. Slim will then try and continue on with the test.
!2 Specifying a custom message
You can specify a custom message to be written into the test output instead of a stack trace. This is done by prefixing your message with {{{message:<<}}} and ending with {{{>>}}} For instance if you want the message to be "Can't create object" then the text for your exception should be {{{message:<<Can't create object>>}}}
!2 Stopping the execution of the test.
If your exception indicates an error that cannot be recovered from, then you may want the test execution to stop at that point. You can do this by throwing an exception with "!-StopTest-!" in the class name. Teardown for the test will still be executed. If the test is part of a suite, then the next test in the suite to be be started afterwards.
By throwing an exception with "!-StopSuite-!" in the class name you can stop both current test and the suite execution. Tear down procedure for the running test and the suite will still be executed, but all the consequent tests in the suite will not run.