Overview - 4Test statements
32
User's Guide
1 O
VERVIEW
The 4Test language
Properties
Statements
By using 4Test flow-of-control statements, you can add logic and robustness
to a recorded testcase. The following table summarizes the statements.
For complete information about all 4Test statements, see the online Help.
To
Use one of these 4Test statements
Execute statement
blocks more than once
for each executes a statement block once for each
element in a list.
for executes the loop once for each increment of a
counter.
while executes a loop until a test condition (boolean
expression) is false.
Conditionally execute
a statement block
if...else executes a statement block based on the value
of a boolean expression.
select executes one case from a group of cases.
switch executes one of the statements that follow,
depending on the value of an expression.
Handle exceptions
do...except handles an exception (error) rather than
having it halt the script.
raise raises a user-defined exception.
reraise reraises an exception the testcase is handling
itself within a do...except statement.
Transfer flow of
control
break transfers control of the script out of the
innermost nested for, for each, while, switch, or select
statement.
continue begins the next iteration of a for, for each, or
while statement without completing the current
iteration.
exit ends the execution the current script.
goto transfers control to the statement prefixed with the
specified label.
return returns control back to the calling function,
optionally passing back a return value.