Image-based automation at a glance
During the introduction of this chapter, we showed an example where default automation (i.e. text-based automation) fails since it is based upon the absolute and relative screen position of UI-elements within the graphical user interface. This chapter introduces the simple, but a mighty concept of image-based automation and its easy application.
In this chapter
Test example preparation
As shown during the introduction of this chapter, the test case is based on a calendar view which may change between the initial test recording and the test run(s).
Image-based test example preparation
In Ranorex Studio, create a new solution without the Solution Wizard and open Recording1 in this solution.
In the recording module view of Recording1, click RECORD.
Now we record the previous test again and in image-based automation mode.
Recording calendar dates in image-based automation mode
Record (click) the three dates ’24’, ’25’ & ’26’ of the current calendar view in the demo application
This will lead to an actions table containing three corresponding action items where the UI-elements have been recorded in image-based automation mode
Image-based automation differs from (default) text-based automation also in a graphical way. Ranorex Recorder outlines the identified UI-elements during recording with green frames (image-based automation) instead of purple frames (text-based automation).
Green UI-element detection frame during image-based automation
Image-based validation with green framed validation element
The test result, when running with the recording conditions at run-time, is the same as with the default text-based automation mode.
Test result in image-based automation mode
- The test report outlines the three executed action items
- Ranorex Recorder correctly identifies the previously recorded calendar dates
Change of test conditions
Assume, again, the change of test conditions in a way, that the calendar view changes to a different month with the dates being at different positions and watch out the result of the image-based automation.
Changed calendar view
Test result with the changed test conditions
Now see the test result of the recorded test with changed test conditions and a different calendar view.
Image-based test result with changed test conditions
- The dates are at different locations within the calendar view
- Nevertheless, Ranorex identifies the previously selected dates ’24’, ’25’ & ’26’ correctly!