Mobile Development 7 min read

Integrating Android Monkey Testing into Jenkins CI

This guide explains how to configure Jenkins to run Android Monkey tests on both emulators and real devices, covering plugin installation, build environment setup, parameterized builds, command-line options, and post-build result publishing for continuous integration of mobile stability testing.

360 Quality & Efficiency
360 Quality & Efficiency
360 Quality & Efficiency
Integrating Android Monkey Testing into Jenkins CI

Jenkins is a Java‑based continuous integration tool widely used for automating build, test, and deployment pipelines. The Android Monkey tool, provided by Google, generates pseudo‑random user events to stress‑test applications on emulators or physical devices.

Integrating Monkey testing into Jenkins allows teams to trigger stability tests automatically during a build, using idle test phones or emulators, eliminating manual command execution.

Emulator configuration : Install the Android Emulator plugin via Jenkins' Manage Plugins, then enable “Run an Android emulator during build” in the build environment, specifying Android version, screen resolution, and SD‑card size as needed.

Build configuration : Add two build steps—“Install Android package” to deploy the APK to the device, and “Run Android Monkey tester” to start the Monkey test. Configure parameters such as event count, interval, and output filename; results are saved as monkey.txt by default.

Post‑build actions : Enable “Publish Android Monkey tester result” to display test outcomes. Set the filename to match the output file and choose the build result status (e.g., unstable) when crashes or ANRs occur.

Real‑device configuration : Ensure the PC has the Android ADB environment variable set. Use a parameterized build to define Monkey options (e.g., event‑count, seed) and a boolean flag to decide whether to run the test.

Build step for real devices : Add an “Execute shell” step that runs a script to install the APK and invoke Monkey via ADB. The basic command syntax is:

adb shell monkey [options] <event-count>

Key options include -p packageName (target package), -s seed (random seed), -v (log level), --throttle MILLISEC (delay between events), --ignore-crashes , and --ignore-timeouts .

Summary : By embedding Monkey testing into Jenkins, developers can automatically perform stability checks on each build for both emulators and real devices, improving test coverage and early detection of crashes. Future work may include a Jenkins plugin to visualize Monkey results more intuitively.

MobileAndroidAutomated TestingCIJenkinsMonkey
360 Quality & Efficiency
Written by

360 Quality & Efficiency

360 Quality & Efficiency focuses on seamlessly integrating quality and efficiency in R&D, sharing 360’s internal best practices with industry peers to foster collaboration among Chinese enterprises and drive greater efficiency value.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.