Text-based validation example | Ranorex
Help CenterUser GuideRanorex Studio fundamentals

Text-based validation example

The purpose of this chapter is to demonstrate the concept of text-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

    Sample solution

    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.

    Training! What do I do?

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

    Download sample file

    Instruction:

    Unzip the project directory to any folder on your computer
    Start Ranorex Studio and open the solution file Introduction.rxsln

    tipp icon

    Hint

    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 definition

    Text-based validation will be demonstrated along an example with the demo application. The test is defined as follows:

    Start the demo application with its introductory working environment
    A standard welcome message ‘Welcome!’ is displayed on the screen
    Insert the text ‘Harry’ into the name text field
    Click Submit

    Changing welcome message in demo application

    Changing welcome message in demo application

    Verify that the welcome message changed accordingly
    Reset the welcome message and close the demo application

    Test preparation

    Follow the instructions herein to prepare the text-based validation example.

    Start Ranorex Studio and open a New test solution
    Give the solution a meaningful name and confirm with Create

    Recording preparation

    Before starting to record it is necessary to select the testing technology and to define the application under test.

    Technology & test application selection

    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

    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 /Downloads/ folder
    Select the program icon RxDemoApp.exe and click Open. The application appears in the selection dialog

    Recording the test – part I

    tipp icon

    Hint

    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

    Starting the test recording

    The application under test comes into front
    Insert Harry into the textfield and click Submit

    Changing welcome message in demo application

    Changing welcome message in demo application

    Text-based validation

    The purpose of the test validation in this example is to verify, if the welcome message in the demo application changed accordingly, i.e. if the submitted text (name) is added to the welcome message.

    Due to the fact, that the validation element is a text field the validation is called text-based validation!

    Activate validation

    Click Validate to pause recording and start the specification of test validation

    Activate text-based validation

    Activate text-based validation

    Select validation element

    Select the text element as validation element

    Selecting text-based validation element

    Selecting text-based validation element

    Important to know:

    • 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 element

    Confirm the pre-selected validation element by clicking Next

    Confirm validation element

    Confirm validation element

    Important to know:

      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 & attributes

      • Here, all the attributes of the selected UI-element are displayed in an overview

      Screenshot of validation UI-element

      • Use the screenshot for a quick verification of the correct validation element selection

      Definition of validation attribute

      Specify the text-attribute for test validation by clicking OK

      Definition of validation attribute

      Definition of validation attribute

      Important to know:

      Selection of the text attribute as validation attribute
      List of all available attributes for selection as validation attribute

      Note icon

      Note

      All available attributes and states which describe and define a UI-element can be used for validation purpose. In order to further specify the validation, multiple attributes and states can be combined in a test validation definition.

      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.

      tipp icon

      Hint

      After confirming the validation attribute definition with OK, Ranorex automatically continues recording where it had been paused when activating validation.

      Finalize and end recording

      Finalize and end recording

      Click Reset to reset the welcome message to its initial content
      Click the Exit button of the demo application
      Click Stop in the Recorder control center to end recording

      Result

      The result is a recording module with 7 recorded actions where action #5 is the validation action.

      Recording result of text-based validation example

      Recording result of text-based validation example

      Validation action
      Validation match operator

      • This operator defines the matching
      • 9 different matching operators are available
      Validation match operators

      Validation match operators

      Further reading

      A detailed description of all validation match operators can be found in > Ranorex Studio fundamentals > Actions > ⇢ Detailed list of actions.

      Validation attribute

      • Column #4 outlines the validation attribute
      • In our current example, the text attribute was specified
      • A drop-down list makes all available validation attributes selectable

      Match value

      • The match value can be a constant (i.e. text, number, …)
      • It can also be a variable holding the match value

      Reference to the validation repository item

      • Finally, column #6 outlines the reference to the validation repository item selected

      Validation interpretation

      The validation is read / interpreted as follows:

      Text-based validation interpretation

      Text-based validation interpretation