On the previous page, we showed you a case where object-oriented testing fails to identify the correct UI elements. On this page, we’ll show you the basics of image-based testing to solve this issue.
In this chapter
As on the previous page, we want to test the following:
In the calendar view of the Ranorex Studio Demo Application, we 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.
We’ll now record mouse clicks on three consecutive dates in the calendar view of the demo application using the image-based approach.
Object-oriented recording with purple frame
Image-based recording with green frame
When you run the test, you’ll see that
In other words, at this point the test results are the same as with object-oriented testing.
Now assume that you run the test a couple of months from its creation. This means that the calendar view will have 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.