CASE ... IS ... WHEN OTHERS... END CASE
System Testing Test Script Language.
Syntax
CASE <expression> IS
WHEN <constant1> => <instructions>
WHEN <constant2> => <instructions>
WHEN <constant3> => <instructions>
WHEN OTHERS => <instructions>
END CASE
Description
The CASE instruction allows you to choose one of several sets of instructions according to the value of an expression.
The CASE instruction may appear in a PROC, SCENARIO, INITIALIZATION, TERMINATION or EXCEPTION block.
The list of options for the expression begins after IS and ends in END CASE.
WHEN identifies the different constant expressions that cause a specific process to be carried out. This process is defined by the instructions following the => symbol.
OTHERS processes all the values of expression that have not been explicitly processed in the CASE. This instruction set is optional.
<expression> must take an integer value.
Examples
##define ACK 0
##define NACK 1
#int choice;
SCENARIO TEST_1
FAMILY nominal
CALL ApiGetChoice(choice)
CASE (choice) IS
WHEN ACK => CALL ApiAcknowledge()
WHEN NACK => CALL ApiReset()
...
WHEN OTHERS => CALL Api_DefaultMsg()
END CASE
...
Related Topics
Multiple Conditions | Conditions