!**< def
!define test1 (!|fitlibrary.specify.workflow.PojoGivesErrorsAndFails|
|''returns false''|'''is'''|true|
|''throws exception''|'''is'''|3|
|''returns false''|'''is'''|true|
|''throws exception''|'''is'''|3|
)
!define test2 (!|fitlibrary.specify.workflow.PojoGivesErrorsAndFails|
|''set stop on error''|true|
|''returns false''|'''is'''|true|
|''throws exception''|'''is'''|3|
|''returns false''|'''is'''|true|
|''throws exception''|'''is'''|3|
)
!define test3 (!|fitlibrary.specify.workflow.PojoGivesErrorsAndFails|
|''set stop on error''|true|
|''throws exception''|'''is'''|3|
|''returns false''|'''is'''|true|
|''throws exception''|'''is'''|3|
)
!define test4 (!|fitlibrary.specify.workflow.PojoGivesErrorsAndFails|
|''runtime configuration''|
|''stop after''|2|''errors or''|2|''fails''|
|''returns false''|'''is'''|true|
|''throws exception''|'''is'''|3|
|''returns false''|'''is'''|true|
|''throws exception''|'''is'''|3|
)
!define test5 (!|fitlibrary.specify.workflow.PojoGivesErrorsAndFails|
|''runtime configuration''|
|''stop after''|2|''errors or''|2|''fails''|
|''throws exception''|'''is'''|3|
|''returns false''|'''is'''|true|
|''throws exception''|'''is'''|3|
|''returns false''|'''is'''|true|
)
**!
Sometimes a storytest can take more than a few seconds to run, such as with web testing.
Once an error or two occurs, the following errors tend to be irrelevant anyway, so there's not point wasting time by continuing.
For example, when a click on a link fails because the link is not there, there's little point in testing the contents of the expected page.
#
!2 1. Here's what happens by default:
#
|!-fitlibrary.spec.SpecifyFixture-!|
|${test1}|!-
fitlibrary.specify.workflow.PojoGivesErrorsAndFails |
returns false |
is |
true expected false actual |
throws exception |
is |
3 error |
returns false |
is |
true expected false actual |
throws exception |
is |
3 error |
-!|
#
!2 2. Stop on any error or fail
#
To stop a storytest on errors, one approach is to stop on any error or fail (yellow or red).
In the following, we stop on a fail (red). The setting applies to this and subsequent storytests (until it's changed), so it can be set at a suite level (eg, in ''!-SuiteSetUp-!'').
The rest of the tables are marked in gray to show they've been ignored:
|!-fitlibrary.spec.SpecifyFixture-!|
|${test2}|!-
fitlibrary.specify.workflow.PojoGivesErrorsAndFails |
returns false |
is |
true expected false actual |
-!|
In the following, we stop on an error (yellow):
|!-fitlibrary.spec.SpecifyFixture-!|
|${test3}|!-
fitlibrary.specify.workflow.PojoGivesErrorsAndFails |
throws exception |
is |
3 error |
-!|
#
!2 3. Finer-scale control of stopping
#
Here we stop after 2 fails:
|!-fitlibrary.spec.SpecifyFixture-!|
|${test4}|!-
fitlibrary.specify.workflow.PojoGivesErrorsAndFails |
runtime configuration |
stop after |
2 |
errors or |
2 |
fails |
returns false |
is |
true expected false actual |
throws exception |
is |
3 error |
returns false |
is |
true expected false actual |
-!|
Here we stop after 2 errors:
|!-fitlibrary.spec.SpecifyFixture-!|
|${test5}|!-
fitlibrary.specify.workflow.PojoGivesErrorsAndFails |
runtime configuration |
stop after |
2 |
errors or |
2 |
fails |
throws exception |
is |
3 error |
returns false |
is |
true expected false actual |
throws exception |
is |
3 error |
-!|
!2 4. Stopping when response is too slow
#
It can be handy to test that things happen within a given expected response time.
A stopwatch can be used to do this. See: .FitLibrary.SpecifiCations.GlobalActionsProvided.StopWatch