"CHECK" script keyword

advertisement
"CHECK" script keyword
A "CHECK" statement has been added to the script language to suspend script execution and ask the
user to check some kind of condition for pass or fail via popup. Syntax for CHECK is as follows:
CHECK "Title" (
"Text line"
"Text line"
...
"Text line"
)
The CHECK statement must appear within a valid TEST section. The "CHECK" keyword must be first
on the line and immediately followed by a quoted title of the check statement. Multiple check
statements can appear in a script and the title identifies which one is currently executing (The title will
be visible in the popup the user sees).
Parenthesis enclose the text that is to appear inside the check popup. At least one quoted string must be
present and there is no limit to how many lines may be included. Each line that is to appear in the popup
must be specified on its own line in the script. Blank lines are specified by an empty quoted string
appearing on its own line. Two strings cannot appear on the same line (no concatenation). The position
of the beginning of the string and the position of each parenthesis can vary as in the following examples.
All three forms produce the same popup display with the exception of the first one only having a single
line of text.
CHECK "Title" ( "Text" )
CHECK "Title"
(
"Text"
...
"Text"
)
CHECK "Title" ( "Text"
...
"Text" )
Quotes can appear within the strings but they must be preceded by a slash: \"
Once the CHECK statement is encountered in the script a popup will appear with the specified text and
two buttons: "Pass" and "Fail". The popup will stay up until the user presses one of the buttons. If the
user presses Fail, the box will disappear and the current test will fail with the title of the check statement
in the sniffer window's fail reason. Execution will proceed to the next TEST section. The icon in the
script's tree (indicated with a '?' in the circle) will be red. If the user presses "Pass", the dialog will
disappear, the tree's check item will be green and script execution will continue.
"If" expressions can appear between any line. This may be useful for specifying different text
depending on parameters as in the following example:
CHECK "Alarm Generation"
(
if (AlarmG = 1)
"Please check to see if the boiler room has exploded."
"Remember that if you go down there to check, notify your nearest of kin."
"If you make it back, you passed the test."
elseif (AlarmG = 2)
"Please sniff for smoke under your desk. Alarm 2 has been tripped."
"Please press FAIL if you are on fire, then roll around, you'll be alright."
else
"Please check for general life safety problems. Is all power diverted"
"to life support? Press "Pass" if the \"Aye!\" word is given."
endif
)
As with all items in the tree, double clicking on item in tree takes user to start of CHECK statement in
script source if a script is not currently executing.
The CHECK statement can appear anywhere other statements can appear, even inside cases. However,
a CHECK statement cannot appear as the beginning of a case, unlike EXPECT and MAKE.
"MAKE" script keyword
A "MAKE" statement has been added to the script language to suspend script execution and ask the user
to perform an action before proceeding. The idea is that the action the user performs is necessary for
continued script execution. Once the action has been performed, the user should press the "OK" button.
The syntax for the MAKE statement follows the same pattern as the CHECK statement:
MAKE "Title" (
"Text line"
"Text line"
...
"Text line"
)
The MAKE statement must appear within a valid TEST section. All of the MAKE syntax follows the
CHECK syntax rules, including all of the variations. IF statements may also appear inside MAKE
statements. The script tree icon designating the MAKE is an 'M' inside a circle. This icon appears white
(unprocessed), yellow (executing), green (passed) or red (failed). Double clicking on the icon will place
the script editor cursor on the beginning of the MAKE statement.
Once the MAKE statement is encountered in the script a popup will appear with the specified text and
two buttons: "OK" and "Cancel". If the user presses "Cancel", the box will disappear and the current
test will fail with the title of the MAKE statement in the sniffer window's fail reason. Execution will
proceed to the next TEST section. If the user presses "OK", the dialog will disappear, the tree's MAKE
item will be green and script execution will continue.
If a MAKE statement is followed in the script by any statement other than an EXPECT statement, the
behavior of the MAKE at execution is exactly like the CHECK statement; A modal dialog will appear
halting script execution until the user presses either "OK" or "Cancel". "Cancel" will generate a fail
reason in the sniffer log. "OK" will allow the script to continue execution. This is also true if a MAKE
statement is the last valid statement in a TEST section.
If, however, a MAKE statement is followed by an EXPECT statement, a group of EXPECT statements
(chained together by ANDs and/or ORs), or a new case level with EXPECT statements that start each
case, the dialog will be modeless and script execution will continue in a state that continually suspends
EXPECT timers. While the MAKE statement is in this state, the popup will stay up and the user is be
free to use the menu to "Kill" script execution or browse through the execution tree.
The dialog will stay up, extending the following statement's EXPECT timers until either the user presses
"OK" or packets that satisfy the EXPECT statements are received. If following EXPECT statements
received packets they were expecting, the dialog will automatically disappear and script execution will
continue. While the popup is being displayed, the icon will appear yellow and all of the following
EXPECT statements will be processing as well, indicated by their icons appearing yellow too. If the
user presses "OK", the dialog will disappear, its icon will change to green and the following EXPECT
statements will continue to process with the specified timeouts, as if the MAKE statement never
preceded them. If the user presses "Cancel", a fail condition will be reported in the sniffer log and all of
the currently processing EXPECT statements (may be multiple due to case or AND/OR chain) will fail
and their icons will turn red.
The following tree shows the proper use of a MAKE statement. While the MAKE’s popup was being
displayed, the MAKE, as well as the EXPECT chain that followed, were all being processed
simultaneously. The green status shows that the MAKE’s popup has been “Oked” by the user and the
following EXPECT chain timers are now in force, waiting for the proper packet to be received. The
icons will turn red or green if either the timers expire or the proper packet is received. In either case, the
MAKE’s status is completed with green. If the user had “Canceled” the MAKE popup, the MAKE’s
icon would appear read as well as all of the following EXPECT chain elements.
AND and OR type EXPECT statements will process as usual, changing the other elements to
unprocessed if one of the statements passes. The first EXPECT statement in an AND chain that passes
will kill the preceding MAKE popup and set its status to green.
Cases require an EXPECT statement to appear as the first element inside a case. This is still true where
MAKEs are concerned because each case clause is evaluated simultaneously, which would get quite
messy with multiple MAKE popups. It is recommended, however, that MAKE statements precede a
new case level which will allow all of the new case level’s EXPECT clauses to process simultaneously
and have their timers indefinitely postponed.
The MAKE is placed prior to the start of a new case level. The case clauses will all begin processing
simultaneously when the MAKE statement is executed and will show in process while the MAKE popup
is displayed.
After the MAKE statement is complete, indicated here as green because the user Oked the popup, the
EXPECT timers are in force and case processing continues as if the MAKE statement was not present.
Whether pass or fail, the MAKE statement’s status is passes unless the user Canceled the popup.
Download