Welcome to the new Ranorex Support Portal

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.

  1. Start the demo application and click the Image-based automation tab.

  2. In Ranorex Studio, create a new desktop solution with the solution wizard and open Recording1 in this solution.

  3. In the recording module view of Recording1click RECORD.

  1. Ensure image-based recording is enabled.

  2. Click the three dates 2425, and 26 in the calendar and stop the recording.

  3. The action table displays the three corresponding actions.

Image-based recording

We’ll now record mouse clicks on three consecutive dates in the calendar view of the demo application using the image-based approach.

Note Icon

Note

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.

  1. Object-oriented recording with purple frame

  2. 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.

  1. 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.

  1. 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.

USERS LOVE US

SUBSCRIBE TO OUR NEWSLETTER

Get the latest test automation information right in your mailbox.

FOLLOW US

© 2024 Ranorex GmbH. All Rights Reserved