Error Handling

System Testing for C

The ERROR Statement

The ERROR instruction lets you interrupt execution of a scenario where an error occurs and continue on to the next scenario at the same level.

ERROR instructions follow these rules:

Note   In debug mode, the behavior of ERROR instructions is different (see Debugging Virtual Testers).

The following is an example of an ERROR instruction:

HEADER "Instruction ERROR", "1.0", "1.0"

#int IdConnection;

SCENARIO Main

  COMMENT connection

  CALL socket(AF_UNIX, SOCK_STREAM, 0)@@IdConnection

  IF (IdConnection == -1) THEN

    ERROR

  END IF

END SCENARIO

 

The EXIT Statement

The EXIT instruction lets you interrupt execution of a Virtual Tester. Subsequent scenarios are not executed.

EXIT instructions follow these rules:

The following is an example of an EXIT instruction:

HEADER "Instruction EXIT", "1.0", "1.0"

#int IdConnection;

SCENARIO Main

  COMMENT connection

  CALL socket(AF_UNIX, SOCK_STREAM, 0)@@IdConnection

  IF (IdConnection == -1) THEN

    EXIT

  END IF

END SCENARIO

 

Related Topics

Exception Environment (Error Recovery Block)EnvironmentsInitialization Environment | Termination Environment