Preparing Android Emulator for Testing

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

Android SDK includes a mobile device emulator that lets you test Android applications without using a physical device. For more information about using the emulator, see the Android documentation:

http://developer.android.com/tools/devices/emulator.html

With TestComplete, you can test Android applications running on this emulator. This topic provides detailed information on how to prepare the Android emulator for testing.

Note: Virtual machines running Android-x86 may have better performance than the Android emulator.

Requirements

To use the Android emulator for testing, your computer must meet the following requirements:

  • An Intel processor that supports the Intel Virtualization Technology. Check that your processor is listed at:

    http://ark.intel.com/products/virtualizationtechnology

  • At least 1 GB RAM.
  • Operating system: Windows 10 (32 or 64-bit), Windows 8 (32 or 64-bit), Windows 7 (32 or 64-bit).

1. Downloading and Installing Software

Downloading Intel x86 Image and Intel HAXM

You need the following software to use the Android emulator with TestComplete:

  • Intel x86 Atom System Image

  • Intel Hardware Accelerated Execution Manager (HAXM) – a hardware virtualization driver that speeds up the Android emulator

You can download them using the Android SDK Manager:

  • Start the SDK Manager.

    • In Eclipse:

      Select Windows > Android SDK Manager.

    • In Android Studio:

      Select Configure > SDK Manager, or select File > Settings and then select Appearance & Behavior > System Settings > Android SDK

  • Select the following items:

    • Intel x86 Atom System Image for the Android version you want use in the emulator

    • Intel x86 Emulator Accelerator (HAXM)

    Android SDK Manager: Installing Intel x86 Atom System image and Intel HAXM

    Click the image to enlarge it.

  • Click OK, accept the license agreements and proceed with the installation.

As an alternative, you can install the packages by using the sdkmanager command-line utility. The utility is shipped with Android Studio or with standalone Android SDK tools:

sdkmanager "emulator" "system-images;android-NN;default;x86"

For detailed information on the utility command-line parameters, see the utility description in the Android documentation.

Installing Intel HAXM

The SDK Manager does not install the Intel HAXM driver automatically, it just downloads the HAXM installation package to the following location:

<Android SDK>\extras\intel\Hardware_Accelerated_Execution_Manager\IntelHaxm.exe

To install the HAXM driver, launch this file and follow the on-screen instructions to complete the installation. For HAXM installation notes, see the Intel web site:

Installation Instructions for Intel® Hardware Accelerated Execution Manager

Note: HAXM does not check for updates automatically. To update HAXM, download the new installation package using the SDK Manager and repeat the installation.

To verify that the HAXM driver is running, open Windows command prompt and run the following command:

sc query intelhaxm

You should see the following output:

SERVICE_NAME: intelhaxm
    TYPE         : 1  KERNEL_DRIVER
    STATE        : 4  RUNNING
    ...

If HAXM is not running, you can start it using the following command:

sc start intelhaxm

2. Configuring an Android Virtual Device (AVD)

Creating an AVD

The emulated Android Virtual Device (AVD) must be based on the Intel x86 image. To create such an AVD, do the following:

  • Start the Android Virtual Device Manager.

    • In Eclipse:

      Select Window | Android Virtual Device Manager.

    • In the Android SDK Manager:

      Select Tools | Manage AVDs.

    • From the Start menu:

      Select All Programs | Android SDK Tools | AVD Manager.

  • Click New to create a new AVD.

  • Set the following AVD options:

    • Target: the Android version of the Intel x86 image that you downloaded

    • CPU/ABI: Intel Atom (x86)

    • RAM: 512 - 1024

    • SD Card | Size: any non-zero value

    • Use Host GPU:

      • checked if Target is Android 4.0.3 - 4.2.2
      • unchecked if Target is Android 4.3 or later

    Specify the AVD name and other options as needed.

    Android Virtual Device Parameters
  • Click Create AVD.

Installing TestComplete Android Agent on AVD

If you are going to test your Android application as an Open Application, the TestComplete Android Agent must be installed on the created AVD.

TestComplete installs the Android Agent on your AVD automatically when you first connect to it.

For complete information on installing the Agent, see the Agent description.

Requirement: In order for the Android Agent to be able to work on an emulator, the emulator must have 512 MB of RAM or more.

3. Connecting Android Emulator to Android Debug Bridge

TestComplete interacts with physical Android devices, emulators and virtual machines via Android Debug Bridge (adb.exe). ADB is part of the Android SDK, along with the Android emulator. In other words, if you have the Android SDK with the emulator, you also have the ADB installed.

When you launch the Android emulator, it is automatically connected to ADB, and TestComplete can work with it when it is ready.

Other Preparatory Actions

Besides preparing the emulator for testing, you also need to configure TestComplete. For detailed information on this, see Preparing Test Computers and TestComplete for Android Testing.

Also, it is recommended to prepare your application for testing and test it as an Open Application. See Preparing Android Applications.

See Also

Preparing for Testing Android Applications
About Testing Android Applications

Highlight search results