Writing self-checking scripts
When you create a self-checking script, you add IF statement logic tests to the script to check for the expected response and to take action if an unexpected response is received. The action can be as simple as stopping the device or as complex as choosing from several possible courses of action based on what was actually received. You can code these logic tests in hand-written message generation decks as well as in decks created by STL or one of the script generating utilities. In addition, you can code logic tests in the network definition.
Below shows an example of a message generation deck with self-checking logic that causes the system to wait for the expected response. In this example, WSim sends Message 1 to the system under test and waits until Reply 1 is received before continuing. After receiving Reply 1, Message 2 is generated and sent to the system under test. WSim waits for Reply 2 before continuing to the end of the message deck.
DECK5 MSGTXT
* Beginning of DECK5.
MSG1 TEXT (MESSAGE 1) Defines MSG1.
0 IF LOC=B+0,
TEXT=(REPLY 1),
THEN=CONT
WAIT1 WAIT
MSG2 TEXT (MESSAGE 2) Defines MSG2.
0 IF LOC=B+0, Defines basic logic test.
TEXT=(REPLY 2),
THEN=CONT
WAIT2 WAIT
ENDTXT End of DECK5.
For a complete explanation of how to produce self-checking scripts by coding logic tests in the message generation decks, refer to Creating WSim Scripts or WSim Script Guide and Reference. Creating WSim Scripts provides more information about coding IF statements that apply to the entire network.