As on the previous page, you want to test the following:
In the calendar view of the Ranorex Studio Demo Application, you want to perform mouse clicks on three different dates (24, 25, and 26) of a month. After changing the month, the mouse clicks should still be performed on the same dates.
-
Start the demo application and click the Image-based automation tab.
-
In Ranorex Studio, create a new desktop solution with the solution wizard and open Recording1 in this solution.
-
In the recording module view of Recording1, click RECORD.
-
Ensure image-based recording is enabled.
-
Click the three dates 24, 25, and 26 in the calendar and stop the recording.
-
The action table displays the three corresponding actions.
Image-based recording
Now record mouse clicks on three consecutive dates in the calendar view of the demo application using the image-based approach.
When image-based recording is enabled, Ranorex Recorder frames UI elements in green instead of purple (object-oriented recording), as shown in the image below.
-
Object-oriented recording with purple frame
-
Image-based recording with green frame
Run the test
When you run the test, you can see that
- The recorded calendar dates are identified correctly.
- Each click action in the report corresponds to the correct date in the calendar.
In other words, at this point, the test results are the same as with object-oriented testing.
Change of test conditions
Now assume that you run the test a couple of months from its creation. This means that the calendar view has changed to a different month. Let’s see how our image-based test performs in this case.
-
In the calendar in the demo application, switch to any month where the recorded dates 24, 25, and 26 are at a different position in the calendar.
-
Run the test again and see what happens.
- The test runs without failure and reports a success.
- Ranorex Studio has identified the correct dates despite their changed positions.
- Image-based testing has solved the issue created by object-oriented testing.
Advanced image-based automation
As you read on the previous page, image-based testing is sometimes the solution to an issue. However, as with any other testing approach, you need to apply it correctly or it will fail.
Proper image-based testing can get challenging when the recorded and the actual image during test execution don’t match. This can be caused by simple things like a UI element being highlighted or icons changing during test execution. False positives, can also be an issue when instead of the intended UI element, a similar-looking one is identified.
Please visit Troubleshooting to find some solutions for common issues on advanced image-based automation settings.