1. Preliminary Steps

Applies to TestComplete 14.71, last modified on April 22, 2021

This topic describes the preliminary actions you need to perform to prepare the environment for testing Android applications with TestComplete.

Note: With TestComplete, you can test applications that are running on physical mobile devices (smartphones and tablets), emulators, and Android-x86 virtual machines.

For the full list of supported and non-supported devices, see About Testing Android Applications.

In this section, we will provide instructions on preparing for testing on a physical device. Preparatory actions for Android emulators and Android-x86 virtual machines are different (see Preparing Devices, Emulators and Virtual Machines). With this exception, the rest of the testing actions are performed in the same manner.

The topic contains the following sections:

Installing Required Software

Installing JDK and Android SDK

To test Android applications, you need to download and install Java Development Kit or Java Runtime Environment (JDK or JRE) ver. 6 - 8 and Android SDK on your test computer.

Notes:

  • Testing Android applications by using Java SE Runtime Environment (JRE) or Java SE Development Kit (JDK) ver. 9 - 11 is not supported currently.
  • If you already have the Android SDK and JDK (or JRE), install the needed platform and build tools via the SDK Manager or the sdkmanager utility as described below.

  1. Download the JDK from:

    http://java.com/en/download/windows_manual.jsp

    For testing, it is enough to have JRE installed, but you may need to download and install JDK, as JDK includes JRE modules.

  2. Run the downloaded installation and follow the instructions in the wizard.

  3. Download the Android SDK from:

    https://developer.android.com/sdk/index.html

    You can download it as part of Android Studio (the default download), or you can download the SDK only.

    To get Android Studio
    1. On the Download page, click Download Android Studio.

    2. Run the downloaded installation and follow the wizard instructions.

    3. After the studio is installed, launch it and select Configure > SDK Manager.

    4. In the SDK Manager, make sure that the following items are selected:

      The SDK Platforms tab

      • Android 10.x

      The SDK Tools tab

      • Android SDK Platform-tools

      • Android SDK Build-tools ver. 26.0.2 or later

      • Google USB Driver

      Android SDK Manager: The SDK Platforms tab

      Click the image to enlarge it.

      Android SDK Manager: The SDK Tools tab

      Click the image to enlarge it.

    5. Click OK to install packages if needed. Accept the license agreement and proceed with the installation.

    To get the SDK only
    1. On the Download page, scroll to the Get just the command line tools section and download the sdk-tools-windows-NNN.zip package.

    2. Extract the files and locate the sdkmanager utility.

    3. Use the utility to install the following items:
      • Android 10.x (on the SDK Platforms tab)

      • Android SDK Platform-tools

      • Android SDK Build-tools ver. 26.0.2 or later

      • Google USB Driver

      To do this, run the utility with the following command-line parameters:

      sdkmanager "platform-tools" "build-tools;NN.N.N" "extras;google;usb_driver"

      Where NN is the version of the API for which you want to install the tools.

Installing Device USB Drivers

As stated above, in this tutorial we will automate tests on the physical device. In order to interact with the device, you need to install the device USB driver on the TestComplete computer. For instructions and driver download links, see OEM USB Drivers in Android documentation:

https://developer.android.com/studio/run/oem-usb.html

Installing and Configuring TestComplete Plugins

To be able to test Android applications, you must have a license for TestComplete Mobile module. This module includes the required plugins.

If the plugins is not available, you need to run the TestComplete installation program in the Modify mode. This will install and activate the required plugins.

Configuring TestComplete

Once the plugins are active, you may need to specify paths to JDK and Android SDK in TestComplete settings. The TestComplete installation wizard tries to find these paths automatically on your computer. If it is unable to do so, you may need to manually specify these paths in TestComplete.

To check whether the paths are specified correctly:

  1. Launch TestComplete.

  2. Select Tools > Options from the TestComplete main menu. This will open the Options dialog.

  3. On the left of the dialog, select the Engines > Mobile > Android category.

  4. In the Path to Android SDK edit box, specify the folder where you installed the Android SDK on your computer.

  5. In the Path to Java Runtime edit box, specify the folder where Java is installed on your computer.

    Getting Started With TestComplete (Android): Configuring TestComplete
  6. Switch to the Engines > Mobile > General category.

  7. Enable the Automatically display Mobile Screen on OnScreen operation option.

  8. Enable the Automatically display Mobile Screen when recording option.

  9. Click OK to close the dialog and save the settings.

Preparing Mobile Device

After all of the required software was installed on the desktop computer, you need to prepare the mobile device as well.

Enabling Developer Options on the Device

To perform testing on a physical Android device, you need to enable certain developer options on the device:

  1. Make the developer options visible. Go to Settings > About phone/tablet and touch Build number 7 times.

    Note: The way in which you make the developer options visible may vary between devices and Android versions. Please, refer to the documentation on your device for more information.
  2. Go to Settings > Developer options and enable the following options:

    • USB debugging - Enables communication between the device and Android Debug Bridge (ADB). In other words, it makes your device visible to ADB and TestComplete.

    • Stay awake - Prevents the device from going into sleep mode during debugging.

    For Xiaomi users: If your Xiaomi device has the USB Debugging (security settings) and Install via USB options, you must enable the options. To do this, you need an active Mi account, and a SIM card must be inserted into the device.

  3. Save the changes.

Connecting the Device

Turn on your device and connect it to your computer with the USB cable. Android Debug Bridge will detect the connection and automatically connect to the device.

Checking Whether Device Is Connected

To verify whether the mobile device has connected successfully:

  • Click the Show Mobile Screen button on the TestComplete toolbar.

The Mobile Screen window will open if at least one mobile device or virtual machine is connected to Android Debug Bridge.

If you have several devices or virtual machines connected, a click on the Show Mobile Screen item will open the Select Current Device dialog that lists the connected devices. Check whether your device or virtual machine is on the list, select it there, and click OK to view its screen.

Now TestComplete and the mobile device are prepared for testing. In the following sections, we will describe how to create a test project, create a simple test, and play it back.

Prev     Next

See Also

Testing Android Applications
Preparing for Testing Android Applications

Highlight search results