Conditions & rules
Conditions and rules enable the more specified control and conditional execution of smart folders and test cases in Ranorex. This section is to show how to set up conditions, define rules and therefore, control the execution based on specific parameters.
In this chapter
Test example definition
To explain the definition and configuration of conditions by means of the current test example, let’s assume, that we only want to insert females into the test database.
Test example definition for conditions & rules
- During the regular test, 8 persons are inserted into the demo application database
- The test case is to be modified in a way, that only females are inserted into the database
- This setting is to be performed by a condition
Adding a condition
Conditions and rules can be applied to either smart folders or test cases. The concept remains the same and is easy to understand.
Defining a condition – part I
Open the context menu and click Condition…
Defining a condition – part II
Click Add rule to start the definition of rules for the current condition
Important to know:
See the Condition register pane of the test container properties dialog window
List of all defined rules for the current condition
One condition can be defined for a smart folder or test case.
Adding & specifying rules
Conditions are based on rules. Up to 10 rules can be combined to form one condition.
Specifying a rule for a condition
Data source: Selection of data type – available are data sources read from files or data taken from parameters set during runtime
Data selection: List of available data sources/parameter depending on the previous selection
Data item: Option to select among any of the available data items (=columns)
Condition operator: Selection of the conditional operator
Relational reference selection: Conditional reference selection based on the selected test data
Condition indicator in test suite view
Indicator showing that the test case or smart folder has a defined condition
A condition can consist of up to 10 rules.
The various options to specify and set conditions are introduced in overview herein.
Condition setting: the selection defines whether all, or any rules drive the test result
Incomplete rule definition indicator: if a rule is incomplete, a warning sign indicates where the rule is incomplete
Rule completeness indicator: a small indicator shows whether a rule is complete, or incomplete
Types of condition
Depending on their completeness and activation status, three types of condition are distinguished:
Types of condition
Active condition with one or more incomplete rules
Inactive condition with one or more rules
Completed sample solution
Find below the link to the prepared completed sample solution.
- Unzip the project directory to any folder on your computer
- Start Ranorex Studio and open the solution file
Test run preparations
To run conditions with the preparation or developed sample solution it is recommended to disable both the test validation recording
ValidateEntries generates wrong validation results in the current setting
Conditional test run settings