Context
Real automation rarely follows a single straight path. Conditions let a test or keyword choose different actions depending on the current state, such as a variable value or an earlier result.
Theory
Robot Framework uses IF, optional ELSE IF and ELSE branches, and a closing END to create conditional blocks. The condition is a Python expression, so comparisons like ${number} > 0 are evaluated directly by the framework.
Task
- Create a *** Keywords *** section with a keyword Check Number.
- Check Number should accept ${number} and return positive when ${number} > 0.
- Otherwise it should return non-positive.
- Create test cases IF Test Positive and IF Test Negative.
Checks
Run your code to see terminal output.
Context
Real automation rarely follows a single straight path. Conditions let a test or keyword choose different actions depending on the current state, such as a variable value or an earlier result.
Theory
Robot Framework uses IF, optional ELSE IF and ELSE branches, and a closing END to create conditional blocks. The condition is a Python expression, so comparisons like ${number} > 0 are evaluated directly by the framework.
Task
- Create a *** Keywords *** section with a keyword Check Number.
- Check Number should accept ${number} and return positive when ${number} > 0.
- Otherwise it should return non-positive.
- Create test cases IF Test Positive and IF Test Negative.