Image-Based Testing in Android Applications (Legacy)

Applies to TestComplete 15.47, last modified on January 20, 2023
The information below concerns legacy mobile tests that work with mobile devices connected to the local computer. For new mobile tests, we recommend using the newer cloud-compatible approach.

To test non-instrumented Android applications, for example, built-in Android applications, or applications that you cannot instrument, you can use image-based tests. In image-based tests, TestComplete identifies Android UI elements by their images rather than by object properties.

To learn more about image-based tests in TestComplete, see Image-Based Testing.

Recording Image-Based Tests

The easiest way to create an image-based test for an Android application is to record it:

  1. Connect your Android device to TestComplete.

  2. In TestComplete, open the Mobile Screen window. You record Android tests in the Mobile Screen window rather than on the device itself.

  3. Start recording.

  4. Work with your tested application through the Mobile Screen window.

  5. If your application is not instrumented, for each control with which you interact, TestComplete will do the following —

    • TestComplete will capture the image of the control with which you interact.

      To determine the control’s borders, TestComplete uses accessibility information it extracts from your non-instrumented Android application.

    • TestComplete will save the image to the Image Repository and generate the image name based on the accessibility information it retrieves from the control.

    • It will record a test command using the captured image as a target.

After the recording is over, you can view and edit the recorded actions.

A sample test looks like this:


Recorded image-based keyword test

Recorded image-based script test

Recording User Actions Over Composite Controls

When TestComplete records user actions over composite controls (for example, date-time pickers, table views or expandable lists), it captures the exact touch point coordinates. It records actions over simple controls (like buttons or check boxes) without coordinates. During the test runs, TestComplete will simulate user actions over simple controls at the center of their recognition area.

For controls whose images you store in your project’s Image Repository, you can specify whether TestComplete should treat them as composite:

  1. Open the Image Repository and select the needed item in the Image Set.

  2. Select the Composite control check box:

    Recording Image-Based Android Tests: Composite Controls

    Click the image to enlarge it.

Related Topics of Interest

Image-Based Testing

Describes general principles of image-based testing in TestComplete.

Recording Android Tests (Legacy)

Describes how to record object-based tests in Android applications.

See Also

About Testing Android Applications (Legacy)
Recording Android Tests (Legacy)
Image-Based Testing

Highlight search results