We can throw an exception AbandonTestSuiteException anywhere in fixture or
Domain Adapter code to stop execution of the entire test suite. The exception can be constructed with a custom message which will appear in the test result.
throw new AbandonTestSuiteException();
throw new AbandonTestSuiteException("my message"); Folder Runner stops reading input files when the suite is abandoned.
The following sets up two tests. The first one throws AbandonTestSuiteException so the second is not run.
test@
make new folder⇓
| with | new | file system |
| make empty folder | test |
| test |
make new folder⇓
| with | new | file system |
| make empty folder | test\input |
| test\input |
| with | new file⇓
| with | new | file system |
| return | make empty file | test\input\abandon.txt |
| test\input\abandon.txt |
| write line | test@ sampledomainadapter |
| write line | throwabandonsuite |
| with | new file⇓
| with | new | file system |
| return | make empty file | test\input\another.txt |
| test\input\another.txt |
| with | execute folder runner⇓
| with | new file⇓
| with | new | file system |
| return | make empty file | test\input\suiteconfig.xml |
| test\input\suiteconfig.xml |
| write line | <suiteConfig> |
| write line | <Settings> |
| write line | <runner>fit.Runner.FolderRunner</runner> |
| write line with path | <inputFolder>test\input</inputFolder> |
| write line with path | <outputFolder>test\output</outputFolder> |
| write line | </Settings> |
| write line | <applicationUnderTest> |
| write line | <addNamespace>fit.Test.Double</addNamespace> |
| write line | </applicationUnderTest> |
| write line | </suiteConfig> |
make new folder⇓
| with | new | file system |
| make empty folder | test\output |
| test\output |
| with | new | folder runner story |
| run | -c,test\input\suiteconfig.xml |
| return | current |
|
| check | results | 0 right, 0 wrong, 0 ignored, 1 exceptions |
@test
FitServer throws an exception when the suite is abandoned to make FitNesse stop sending tests.
The following runs a suite with two tests. The first one throws AbandonTestSuiteException so the second is not run.
test@
| configure | processor | add operator | compareregex |
| add page | test@,fit.Test.Double.SampleDomainAdapter,throwabandonsuite |
| check | results | /(?s).*SampleDomainAdapter.* \(Test completed\) \(Suite abandoned\)/ test@
| fit.Test.Double.SampleDomainAdapter |
throwabandonsuite
fitSharp.Fit.Exception.AbandonSuiteException: Suite abandoned.
at fit.Test.Double.SampleDomainAdapter.ThrowAbandonSuite() in /home/mikes/code/fitsharp/source/fitTest/Double/SampleDomainAdapter.cs:line 29
|
(Test completed) (Suite abandoned) |
@test