Conditional branching performs different actions depending on whether a specified boolean condition evaluates to true or false.
The block structure for IF statements in Subject7 is a lot like most programming languages:
IF ( boolean condition )
( consequent )
ELSEIF ( another boolean condition - optional )
( consequent )
ELSE
( alternative )
ENDIF
For example, in a Subject7 test, this would look like:
SET_VAR HALT Static first_name "Paul"
IF HALT TEXT "@first_name" = "John"
PRINT "first_name is John"
ELSE_IF HALT TEXT "@first_name" = "George"
PRINT "first_name is George"
ELSE
PRINT "first_name is not John or George"
END_IF
The following video goes over the same steps in a test case. Notice the order in which the conditions where met/not met:
Comments
Please sign in to leave a comment.