StopTestFixture is a fixture with helper methods to allow a test to be aborted in certain cases.
Sometimes (in larger test) there is no use in continuing the rest of the test if certain basic checks at the start are not met. This fixture allows a test to be stopped in such cases.
Basic commands are shown in the first table below. The next tables give an idea of more realistic usage.
script | stop test fixture | ||
stop test if | Bye | is | Hello |
stop test if | Hello | is not | Hello |
The expected use is that some other fixture is used (in a script) to assign the outcome of a measurement to a variable. The contents of this variable can the be checked using StopTestFixture, and if the value does not meet the expectation the execution of the rest of the page is skipped.
script | string fixture | |||||
$myResponseCode<-[Hallo] | value of | Hallo | ||||
$myResponse<-[H] | replace all | [a-z]* | in | Hallo | with | |
$myInt<-[100] | convert to int | 100 |
script | stop test fixture | ||
stop test if | $myResponseCode->[Hallo] | is not | Hallo |
stop test if | $myResponse->[H] | is | B |
stop test if | $myInt->[100] | is not | 100 |