Decision Making Statement
Last updated
Last updated
Decision Making Statements are essential for automating test execution by enabling dynamic decision-making. They help control the flow of execution based on specified conditions, ensuring that the test behaves differently under different scenarios.
These include:
IF Statement
IF-Else Statement
The If Statement executes a specific action if a given condition is met.
Navigate to the test case and click on "Add Step" Dropdown.
Choose the 'IF Condition' block.
Click on the condition icon to define the condition and parameters.
Define the parameters:
Add Parameter: Type '#' to select the object or type '/' to select a parameter.
Operator: Choose the comparison type (e.g., equal to, greater than, contains).
Parameter: Set the expected value.
Description: Provide a brief explanation.
Click Save to apply the condition.
Specify the steps within the IF block to execute if the condition is met.
Example:
Condition: If the login status is "Success"
Action: Proceed to the dashboard.
The IF-Else Statement executes one action if the condition is met and another action if it is not.
Follow the same steps as for the IF Condition.
After defining the IF Condition, add an ELSE Condition.
Define the alternate steps to execute if the condition is not met.
Click Save.
Condition: If the login attempt is successful
Action: Redirect to the homepage
Else: If login fails
Action: Show an error message