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
Select the smart folder or test case which is to be made conditional
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
Conditional test case or smart folder 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 activation/deactivation: conditions can be activated / deactivated by simply clicking the checkbox
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 complete rules
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
The sample solution is available for Ranorex versions 8.0 or higher. You need to agree to the automatic solution upgrade for versions 8.2 and higher.
Test run preparations
To run conditions with the preparation or developed sample solution it is recommended to disable both the test validation recording module
ValidateEntries where the correct database counter is verified and the
ExitAUT recording module.
ValidateEntries generates wrong validation results in the current setting and
ExitAUT prevents you from seeing the condition result due to closing the demo application right after the test run.
Conditional test run settings