In software testing, validation is the process of verifying that the behavior and/or responses produced by the application under test match the expected results. This chapter describes the test validation approaches available in Ranorex Studio.
For simplicity, this chapter demonstrates validations that use constant values to determine whether the application returns an expected result. In practice, you will normally want to use variables for validation rather than constant values.
To learn how to use variables in validation actions, refer to the following section:
Ranorex Studio advanced > Variables and parameters > ⇢ Validation variables.
In this chapter
Let’s begin with a simple example of test validation. Imagine a standard pocket calculator that you use to add two numbers:

Test validation succeeds if the calculator returns the expected result, 57.79.
However, the manufacturer of the pocket calculator needs to guarantee that not only this result is correct, but also all other results, from the simplest addition to any other complex built-in mathematical formula.
This is where test validation comes into play. Automated testing makes it possible to cover as many different calculations with different input data and results as necessary in order to prove that the calculator works correctly.
It is important to understand that GUI test automation provides indirect test validation only. This means that we verify whether the user input sequence of:

leads to the result of:

Indirect validation verifies that the displayed result is similar to the expected result based on the user input. It does not ensure whether the calculator works correctly.
In other words, if test validation fails, there is no evidence of what went wrong. It could be that the software processes everything correctly, but the displaying of the result went somehow wrong. Test data may contain erroneous data. You always need to be aware that we are not able to validate the internal processing steps within a computer system, but only the ‘outside’ visible results. Keep that in mind when designing your test cases.
Test validation is a process with four consecutive steps which are listed below. You can create a test validation action during recording or add it manually later.

Within Ranorex, validation is treated as a special type of action. So, to “activate” a test validation simply means to add a validation action to the current recording module. The instructions below describe adding a test validation during a recording session. As mentioned earlier, validation actions can also be added manually after recording.
If you are not familiar with test actions, we recommend reading
Ranorex Studio fundamentals ⇢ Actions

To configure text-based validation:
To configure image-based validation:
The second step of the validation process is to select the UI element to be validated. The selection process is independent of the type of validation (i.e. text/attribute/image-based validation).
Move the mouse over the UI element to be validated. Look for a purple frame to appear around the UI element, indicating that Ranorex Studio has identified it. Click to select the UI element.

Selection of a text-based validation element.
Selection of an image-based validation element.
The third step of the validation process is to confirm that the correct UI element was selected for validation. If so, click Next. Otherwise, correct the selection.

UI element location within GUI
UI element states and attributes
Screenshot of the UI element
UI elements, their representation within Ranorex and their states and attributes are covered in
Ranorex Studio advanced > ⇢ UI elements

Confirmation of text-based validation element.
Confirmation of image-based validation element.
Each UI element is defined by states and attributes. During the final step, specify the particular attribute or state to be used for validation, as shown below.

Attribute/state selection for text/attribute-based validation
(Sub-)image selection for image–based validation
Image validation mode
To learn more about the three types of validation, refer to the examples linked below:
Further reading
To learn more about UI elements, refer to
Ranorex Studio advanced > ⇢ UI elements.
To learn more about image-based automation, refer to
Ranorex Studio advanced > ⇢ Image-based automation.