BT

InfoQ Homepage News Google Enables Continuous Testing Using the Android Emulator

Google Enables Continuous Testing Using the Android Emulator

Bookmarks

The Android Emulator is the main tool Android developers use to test their apps. Google has just made integrating the Android Emulator within a continuous testing pipeline easier by open sourcing the Android Emulator Container Scripts and two related tools.

The Android Emulator Container Scripts are a set of Python and shell scripts meant to automate the process of running the Android emulator in a Docker container. This enables the use of an Android emulator instance running remotely within a continuous testing pipeline, says Google.

Developers can easily choose which emulator version to download and create a Dockerfile to containerize it. The command supporting this is emu-docker which allows developers to choose a system image and emulator version from a list and then manually download it using wget. Once the files are available locally, Docker can be used to build the image and run it with the proper port mapping in place, ready for a connection to be established via the Android Debug Bridge (ADB) CLI tool:

docker run -e "ADBKEY=$(cat ~/.android/adbkey)" --device /dev/kvm--publish
5556:5556/tcp --publish 5555:5555/tcp <docker-image-id>

This last step can be automated with the provided ./run.sh script. Once the container is running, communication with the emulator is enabled through port 5555:

adb connect localhost:5555

ADB is also used to track failures due to bugs and to diagnose their cause.

Two key pieces of the the Android Emulator Container Scripts are the Android emulator download script and the Docker image generator. The former aims to automate the emulator download step described above. Currently, it only supports downloading the current version of the emulator, but Google say it will eventually support the possibility of downloading older versions to enable reproducing legacy test results. The Docker image creator is responsible for creating a suitable environment for the Android emulator to run. This includes supporting ADB, gRPC, and WebRTC. This script is only supported on Linux at the current time, but it will be ported to macOS and Windows as well, according to Google.

As an additional bonus, the containerized Android emulator can be run inside a Web browser with WebRTC. This requires running two additional containers, one for the Envoy web proxy required by gRPC, and another for nginx, which will serve the emulator React app. Remote streaming of the emulator can also be used to identify and diagnose bugs.

To use the Android Emulator Container Scripts, you will need to install Docker, Docker-compose, and KVM, which is mostly a concern if you attempt to use a Cloud service to run the container. Both Python 2 and Python 3 are supported.

Rate this Article

Adoption
Style

Educational Content

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.