Welcome to the new Ranorex Support Portal

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.

Download

Sample solution


Theme: Text-based validation
Time: Less than 30 min

Install the sample solution:

  1. Unzip to any folder on your computer.

  2. Start Ranorex Studio and open the solution file Introduction.rxsln

Test definition


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.

Text-based validation


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:

Activate validation

  1. Click Validate. Recording pauses and the Recorder switches to validation mode.

Select validation element

  1. 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

  1. To confirm the UI element, click Next.

  1. 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.
  1. UI element states and attributes

  • Here, all the attributes of the selected UI element are displayed.
  1. Screenshot of validation UI element

  • Use the screenshot to quickly check whether you’ve selected the correct UI element.

Define validation attributes

  1. The attribute Text is usually preselected. If it isn’t, select it. Click OK to confirm.

  1. Text is selected as validation attribute.

  2. Other attributes available for validation.

Result


The finished recording contains five actions. Action #4 is the validation action.

Recording result of text-based validation example
  1. Validation action

  2. Validation type operator

  • This operator defines what type of validation will be carried out.
  • There are 9 different validation type operators.
Validation type operators.
Download

Further reading


A detailed description of all validation type operators can be found in Ranorex Studio fundamentals > Actions > ⇢ Action properties.

  1. Validation attribute

  • Column #4 shows the validation attribute.
  • In our example, this is the Text attribute.
  • You can select other attributes from the drop-down menu.
  1. Match value

  • The match value can be a constant (i.e. text, number, etc.) or a variable.
  1. 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:

If the Text attribute of the UI element referenced by LblWelcomeMessage is equal (AttributeEqual) to “Welcome, Harry!“, THEN the validation returns the value True.

USERS LOVE US

SUBSCRIBE TO OUR NEWSLETTER

Get the latest test automation information right in your mailbox.

FOLLOW US

© 2024 Ranorex GmbH. All Rights Reserved