Attribute-based validation example
The purpose of this chapter is to introduce and explain the concept of attribute-based validation based on a simple example. Before working with this example, it is recommended that you make yourself familiar with the concept of test validation.
In this chapter
The complete sample solution can be downloaded and you are invited to experiment with the solution. Alternatively, you can follow the instructions below to build your own test 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.
Attribute-based validation will be demonstrated along with an example with the demo application. The test is defined as follows:
Click the Green light radio button in the radio button group box
Verify if the green pattern appears beside the button
Close the demo application by clicking the Exit button
Stop the recording
Attribute-based example test definition
Follow the instructions herein to prepare the attribute-based validation example.
Start Ranorex Studio and open a New test solution
Give the solution a meaningful name and confirm with Create
Before starting to record it is necessary to select the testing technology and to define the application under test.
Technology & test application selection
Click Record in the Recorder view of Ranorex Studio
Click Desktop for testing a desktop application
Selecting the application under test
Click Add app… for adding an application
Use the explorer dialog to search for your application to be tested. In this example, we choose the demo application in the
Select the program icon
RxDemoApp.exe and click Open. The application appears in the selection dialog
Recording the test – part I
Remember that all user interactions are recorded once the Recorder is started.
- Clicking Pause stops recording, Continue proceeds with recording again
- Stop ends the recording
Details about the Recorder control center are summarized in > Ranorex Studio fundamentals > Ranorex Recorder > ⇢ Recorder control center & hotkeys.
Start the recording. Ranorex Studio disappears into the background. The Recorder control center indicates active recording
Starting the test recording
The demo application comes into front. Click UI-element test area
Click the radio button Green light
Clicking a radio button in the demo application
The purpose of the test validation in this example is to verify if the color field which appears after clicking the radio button is displayed in the color ‘Green’.
Due to the fact, that the validation element is a color attribute, the validation is called attribute-based validation!
Click Validate to pause recording and start the specification of test validation
Select validation element (attribute)
Select the green colored UI-element (rectangle) as validation element
Select validation UI-element
- Move the mouse to the validation element of your choice
- A purple frame follows the mouse movement and ‘grabs’ UI-elements on its way
- Once you achieve the proper selection – click it!
Confirm validation UI-element
Confirm the pre-selected validation element by clicking Next
Confirm validation UI-element
See the selected validation UI-element:
- The UI-element is assigned the role
- … has the
See the screenshot of the selected UI-element with the green rectangle
Definition of validation attribute
Specify the validation attribute and confirm with clicking OK
Specify validation attribute
Important to know:
The general attribute
Exists is preselected per default
Additionally select the dynamic attribute
BackColor='Green' as validation attribute down the attribute list
Recording the test – part II
After specifying the validation action, Ranorex automatically continues the recording. You now need to finalize and end the test recording. Follow the instructions below.
After confirming the validation attribute definition with OK, Ranorex automatically continues recording where it had been paused when activating validation.
Finalize & end recording
Click the Exit button of the demo application
Click Stop in the Recorder control center to end recording
The result is a recording module with 5 recorded actions where action #4 is the validation action.
Recording result of attribute-based validation example
Action #4 is the validation action
Validation match operator
- This operator defines the matching
- 9 different matching operators are available
Validation match operators
- Column #4 outlines the validation attribute
- In the current example, the
BackColorattribute was specified
- A drop-down list makes all available validation attributes selectable
- The match value can be a constant (i.e. text, number, …)
- It can also be a variable holding the match value
- Finally, column #6 outlines the reference to the validation repository item selected
The validation is read / interpreted as follows: