While competing in the exacting modern software market, many companies find integrating automated testing into their overall testing process beneficial. This guide will help you better understand the different types of automated test solutions and how developers...
Text-based validation example
This chapter uses a simple example to explain the concept of text-based validation. Before working with this example, make sure you’re familiar with the ⇢ basic concept of test validation.
In this chapter
Download the sample solution
To follow along with the steps in this chapter, download the sample solution file from the link below.
Install the sample solution:
Unzip to any folder on your computer.
Start Ranorex Studio and open the solution file
Before we start recording our test, let’s define it. The test consists of 5 steps:
1. Open the Ranorex Demo Application.
2. In the “Enter your name” field, enter Harry and click Submit.
3. Verify that the welcome message changes accordingly.
4. Reset the welcome message.
5. End the demo application and stop the recording.
The purpose of the test validation in this example is to verify whether the interaction in step #2 of our test definition leads to the desired result, i.e. if the welcome message changes accordingly. Since this requires us to validate the text contained in a text field, we’re carrying out a text-based validation.
Let’s go through the steps:
Click Validate. Recording pauses and the Recorder switches to validation mode.
Select validation element
Select the UI element to validate:
- Mouse over the changed welcome message. A purple frame follows your mouse movement.
- The purple frame indicates which element is currently selected for validation.
- Once your selection matches the welcome message, click it.
Confirm validation element
To confirm the UI element, click Next.
UI element location within GUI
- Here you can correct the previous choice by selecting any other UI element for validation.
- The UI element tree represents the hierarchical GUI structure of the application.
UI element states and attributes
- Here, all the attributes of the selected UI element are displayed.
Screenshot of validation UI element
- Use the screenshot to quickly check whether you’ve selected the correct UI element.
Define validation attributes
The attribute Text is usually preselected. If it isn’t, select it. Click OK to confirm.
Text is selected as validation attribute.
Other attributes available for validation.
All attributes and states that describe and define a UI element can be used in validations. You can also validate several attributes and states at once to make a validation more specific.
The finished recording contains five actions. Action #4 is the validation action.
Recording result of text-based validation example
Validation type operator
- This operator defines what type of validation will be carried out.
- There are 9 different validation type operators.
Validation type operators.
- Column #4 shows the validation attribute.
- In our example, this is the Text attribute.
- You can select other attributes from the drop-down menu.
- The match value can be a constant (i.e. text, number, etc.) or a variable.
The linked repository item
- Column #6 shows the repository item the action is linked to, i.e. the UI element on which the validation is performed.
Interpreting the validation
Spelled out, the validation reads as follows:
Text attribute of the UI element referenced by
LblWelcomeMessage is equal (
AttributeEqual) to “Welcome, Harry!“, THEN the validation returns the value