Applies to TestComplete 14.10, last modified on June 5, 2019

The easiest way to create Android tests is to record them. You can record tests in the Mobile Screen window. However, multi-touch gestures can be recorded on physical devices only.

If your Android application is compiled with the PatchServices.jar library, TestComplete records object-based tests. For unprepared applications, TestComplete records image-based tests.

Before Recording

  • Before recording an Android test for the first time, configure TestComplete, your Android device and (optionally but highly recommended) your Android application. For instructions, see Preparing for Testing Android Applications.

  • Open the Mobile Screen window and make sure TestComplete "sees" your device. See Connecting TestComplete to Android Devices.

    If multiple devices are connected to TestComplete, select the needed device from the combo box on the Mobile Screen’s toolbar:

    Selecting mobile device for test recording
  • Install TestComplete Android Agent on the mobile device. The Android Agent is a helper application used to exchange data with the Android applications prepared for testing with TestComplete.

    When you open the Mobile Screen window, TestComplete verifies whether the Agent is installed and running on the chosen device. If the Agent is not found, the Mobile Screen window displays a message suggesting that you enable the Agent. To install and start the Agent, click the Enable link in the message, or press the Install Android Agent button on the Mobile Screen toolbar.

  • (For image-based tests) If you use Android 4.0-4.0.2, do something in the Mobile Screen window, for example, touch somewhere. This will ensure correct recording.

Recording Tests

  1. To start recording, do any of the following:

    • Click Record Keyword Test or Record Script on the Test Engine toolbar.

    • Select Test | Record | Record Keyword Test or Test | Record | Record Script from the TestComplete main menu.

    • Press Shift+F1 (the shortcut can be changed in the Global Shortcut Options).

    The Recording toolbar will appear on the screen.

  2. Perform test actions in the Mobile Screen window.

    Tips:

    • To record text input, click the text field in the Mobile Screen window and then enter text using your computer’s keyboard. See below.

    • To record pressing device buttons (Home, Back and others), click the corresponding buttons in the Mobile Screen’s footer. See Simulating Physical Button Events.

    • To record a multi-touch gesture, click Record Gesture on the Mobile Screen toolbar and follow the onscreen instructions. See Recording Gestures (Multi-Touch Events).

  3. To stop recording, do any of the following:

TestComplete will open the recorded test in an editor, so that you can review and change it, if needed.


Sample recorded keyword test

Sample recorded script

Recording Text Input

Text input on a mobile device is usually made by using an onscreen keyboard. Currently, TestComplete is unable to record text input from the onscreen keyboard. To record test input, use the host computer's keyboard:

  • During test recording, select the appropriate text field in the Mobile Screen window.

  • Type the desired text using your computer’s keyboard.

TestComplete always records text input using the SetText action.

Notes

  • During test recording, TestComplete actively exchanges data with the tested Android application. If you are recording a test on a virtual machine, or on a physical Android device connected via Wi-Fi, the data goes through your local network. So, you might experience a slowdown when interacting with the tested application, especially if your local network is busy.

    For physical devices, a possible workaround is to use USB-connected devices for test recording, and to use Wi-Fi connections for test runs.

  • During recording, TestComplete captures images of the device screen and displays them in the Test Visualizer panel. These images help you understand what operations your test performs.

  • When recording white-box tests, TestComplete does not record user actions on disabled (grayed) Android controls. If you need your test to simulate such actions, create the corresponding test commands manually.

See Also

About Testing Android Applications
Creating Tests for White-Box Android Applications
Image-Based Testing in Android Applications
Simulating Basic Touch Actions Over Android Devices
Simulating User Actions Over Android Devices
Simulating Gestures (Multi-Touch Events)

Highlight search results