Creating self-checking scripts
Self-checking scripts verify whether the expected responses are received from the system under test. The action taken when WSim finds a problem depends on the cause of the problem, such as incorrectly written scripts, bugs existing in the application, or temporary system problems that require a particular sequence of terminal recovery actions.
After sending a message, self-checking scripts use IF statement
logic tests to scan messages received by the terminal for the expected
response. If the response is correct, the terminal proceeds further.
If not, the discrepancy should be noted and fixed. This sequence is
demonstrated in Figure 1.
Figure 1. Self-checking script logic

You can code simple, message-level self-checking scripts, or more complex, network-level self-checking scripts to recover from errors automatically. As discussed in the following sections, both types of scripts can save time and find unexpected problems with your application systems.