Quantcast
Channel: Testing – Falafel Software Blog
Viewing all articles
Browse latest Browse all 68

Testing Android Apps on Emulators

$
0
0

There’s going to be a rumble

Emulators like the original Android SDK emulator and the newer Visual Studio Emulator for Android allow you to test on a wide range of Android OS versions. But don’t expect them to play nice together. The Android SDK Emulator uses HAXM (Hardware Accelerated Execution Manager) and the Visual Studio emulator depends on Hyper-V. You can manually enable and disable Hyper-V in Control Panel under Programs > Turn Windows Features on or off. You will have to reboot to have the changes recognized.

See Visual Studio Emulator for Android for more information on this alternative.

Setting up the Android SDK Emulator

By installing Android Studio, you get a lot of setup for free. The default install includes the Android SDK, the Android Virtual Device (the emulator) and HAXM.

Android Studio Setup dialog

Before you can run the emulator, you’ll need to the Android SDK Manager to install the SDK platform and a system image of the Android version you want to use for testing. TestComplete fully supports Android version 6.0 all the way back to 4.1.x. To run the SDK manager, find your Android SDK directory, navigate to the \tools folder and run android.bat. On my machine, the path for android.bat is C:\Users\<your name>\AppData\Local\Android\sdk\tools.

In the SDK manager select the SDK platform and Intel x86 system image and click the Install Packages button.

Android SDK Manager package selections

Then you can define an Android Virtual Device (AVD). The AVD is a profile that defines the makeup of the emulator: it’s Android Version, dimensions, storage space and so on. From the SDK manager’s Tool menu, select Manage AVDs.

A few observations:

  • The AVD Name shows in the title bar of the emulator, but doesn’t appear in the Object Browser.
  • In the Device drop down, select a device that allows the Intel Atom (x86) system image. Google Wear apps have their own system image that is not supported by TestComplete as of this writing.
  • Target can be any API between 4.1.x to 6. Android versions 4.0.1 – 4.0.4 are possible but have limited support.
  • Android Agent requires 512 or more of RAM.
  • SD Card must have a value greater than zero to allow image-based testing.
  • Enabling Use Host GPU makes the emulator look a little nicer but doesn’t seem to effect the Mobile Screen display.

Editing a Android Virtual Device (AVD)

Launching and Connecting the Emulator

Once you’ve created the AVD, select it from the list and click the Start button.

Starting an AVD

When the Launch Options dialog shows, take the defaults and click Launch. On my system it takes about 30 seconds to boot to the launcher screen. Ok, we’re cooking with gas, but will TestComplete connect? The short answer is that the TestComplete uses the Android Debug Bridge (ADB) to talk with physical devices and the emulator equally well. The screenshot below shows the emulator on the left and the TestComplete Mobile Screen on the right.

Note: When you install the Mobile module or run TestComplete with the Mobile module installed, it fires up adb.exe automatically.

Emulator and Mobile Screen running side-by-side

Does the Object Browser recognize the emulator? Check. Can I install packages via the Run Apps list in the Mobile screen? TestComplete uses ADB under the covers, ADB can install packages, so yes again.

emulator showing in the Object Browser

Wrap Up

We setup an Android Virtual Device and ran it on the Android emulator. Because TestComplete uses ADB and ADB is able to communicate with both physical devices connected through USB and emulators equally well. Now that we have devices visible to TestComplete, we can move on to image-based testing.

See you all tomorrow.

The post Testing Android Apps on Emulators appeared first on Falafel Software Blog.


Viewing all articles
Browse latest Browse all 68

Trending Articles