QA tester, automation specialist, automation systems engineer — these are just a few of the names for a test automation engineer. No matter what their title may be, they're essential to the software development life cycle, so here's a look at what they do. Markets and...
Image-based testing basics
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
The image-based approach
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.
We’ll now record mouse clicks on three consecutive dates in the calendar view of the demo application using the image-based approach.
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.
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’ll 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 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.
- 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.