Recording Tests for Hybrid Mobile Applications (Legacy)

Applies to TestComplete 14.90, last modified on June 15, 2021
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.

The easiest way to create tests for hybrid mobile applications is to record them. You can record tests in the Mobile Screen window. Multi-touch events (gestures) can be recorded with physical devices only.

It is important that your hybrid mobile application be prepared for testing (instrumented). Otherwise, TestComplete will be unable to recognize Android controls and web elements. (For unprepared applications, it records image-based tests that work with the application through images.)

Before Recording

  • Prepare TestComplete, your device and application for testing. See Preparing for Testing Android Applications (Legacy).

    You can prepare TestComplete and the device only once - before you start recording a test for the first time. As for your tested application, you need to prepare (instrument) it after each compilation of the application.

    If your device uses Android 4.1 or later, and if the tested application loads HTML files from a local drive, you may need to enable the Update WebView settings to allow access to frame elements setting to be able to record your actions on controls that are in frames. To view or change the setting, open the Open Applications | Hybrid mobile category of the project properties.

  • Open the Mobile Screen and make sure TestComplete “sees” your device. See Connecting TestComplete to Android Devices (Legacy).

    If several 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
  • For Android devices: 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, TestComplete verifies whether the Agent is installed and running on the chosen device. If the Agent is not found, the Mobile Screen 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's toolbar.

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 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 (Legacy).

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

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

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


Hybrid mobile testing with TestComplete: Sample recorded keyword test

Hybrid mobile testing with TestComplete: 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 on Android devices. To record test input, use the host computer's keyboard:

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

  • Type text using your computer’s keyboard.

TestComplete always records text input by using the SetText action.

Notes

  • TestComplete does not support test recording on web pages displayed in iOS WKWebView controls. You can record tests on iOS hybrid applications that use UIWebView controls only. If your application uses WKWebView, create tests manually.

  • During test 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 tests for hybrid Android applications, 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

Testing Hybrid Mobile Applications (Legacy)
Testing Hybrid Mobile Applications - Overview (Legacy)
Creating Tests for Hybrid Mobile Applications Manually (Legacy)
Common Tasks for Hybrid Mobile Application Testing (Legacy)

Highlight search results