Write and explain decision making command?

You can incorporate decision-making into your test scripts using if/else or switch statements.
i. An if/else statement executes a statement if a condition is true; otherwise, it executes another statement. It has the following syntax:
if ( expression )
statement1;
[ else statement2; ]
expression is evaluated. If expression is true, statement1 is executed. If expression1 is false, statement2 is executed.
b. A switch statement enables WinRunner to make a decision based on an expression that can have more than two values. It has the following syntax:
switch (expression )
{
case case_1: statements
case case_2: statements
case case_n: statements
default: statement(s)
}
The switch statement consecutively evaluates each case expression until one is found that equals the initial expression. If no case is equal to the expression, then the default statements are executed. The default statements are optional.

 

This Question is not yet answered!

 
 

Related Answered Questions

 

Related Open Questions