In software testing, validation is the process of verifying that the behavior and responses of the application under test match the expected results. This article describes the validation approaches available in Ranorex Studio.
For simplicity, the examples below use constant values to determine whether the application returns the expected result. In real projects, you will typically use variables instead of constants.
Understanding validation
Let’s begin with a simple example of test validation. You use a pocket calculator to add two numbers and expect a specific result. Validation succeeds if the calculator displays the expected result.
Test validation succeeds if the calculator returns the expected result, 57.79.
However, the manufacturer must ensure not just one correct result, but that all supported calculations produce correct results. Automated testing makes it possible to cover many different calculations with different input values and results to show that the calculator works correctly.
Ranorex Studio helps you automate this kind of validation for your applications under test.
Indirect validation
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 checks that the result displayed on the screen matches the expected result based on the user input. It does not prove that the internal processing of the application is correct.
- Many processing steps may occur between the user input and the final display of the result.
- When validation fails, the visible result is incorrect, but the root cause could lie in the display, in the processing logic, or in the test data.
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 display of the result went wrong somehow. 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.
Validation Process
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.
Activate validation
Within Ranorex, validation is treated as a special type of action. “Activating” validation means adding a validation action to the current recording module.
The steps below describe how to add a validation action during a recording session. You can also add validation actions manually after recording.
- To configure text-based validation, click Validate to activate text-based validation mode
- To configure image-based validation, activate the switch Image-based recording, and click Validate to activate image-based validation mode
Select the validation element
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
Confirm the validation element
The third step is to confirm that the correct UI element was selected for validation. If the selection is correct, click Next. Otherwise, adjust the selection before you continue.
Confirmation dialog components
-
UI element location within GUI
Ranorex identifies every UI element within the application under test.
All UI elements are managed in a hierarchical structure.
The names of the UI elements are derived from their underlying type and content. -
UI element states and attributes
Each UI element is defined by a set of attributes and states.
An example of a state is Enabled with a current value of True.
An example of an attribute is the UI element’s name. In the example above, the text attribute has the current value lblWelcomeMessage. -
Screenshot of the UI element
A screenshot of the selected UI element is displayed for confirmation.
Confirmation action
- Confirmation of text-based validation element
- Confirmation of image-based validation element
Define validation attributes
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
Any of the available attributes/states can be selected.
The text attribute is the default attribute for text-based validation.
Select the attribute and click OK to confirm. -
(Sub-)image selection for image–based validation
A sub-region of the image can be selected by drawing a pink rectangle within the image.
If you do not select a sub-region, the complete image is used for test validation. -
Image validation mode
None = No image-based validation; validation discarded.
Contains = Checks that a matched image is contained within a reference validation image.
Compare = Checks a matched image against a complete reference validation image.
Validation examples
To learn more about the three types of validation, refer to the examples linked below: