What is Monkeyrunner
Providing an API for writing programs that control an android
device or emulator from outside of Android code.
Writing python based test tool and runing python script for
Sending keystrokes to device, takes screenshots of its user
interface, and stores screenshots on the workstation.
Testing applications and devices at the functional/framework
level and for unit test.
What can Monkeyrunner Do
Multiple device control
Multiple Device Control
Apply one or more test suites across multiple devices or emulators
Physically attach all the devices or start up all the emulators (or
both) at once, connect to each one in turn programmatically, and
then run one or more tests.
Start up an emulator configuration programmatically, run one or
more tests, and then shut down the emulator
Functional testing Regression testing Extensible automation
Monkeyrunner can run an automated start-to-finish test of an Android
Programmers provide input values with keystrokes or touch events
Monkeyrunner takes screenshots to show the results.
Multiple device control Regression testing Extensible automation
Test application stability by running an application and comparing its
output screenshots to a set of screenshots that are known to be
Functional testing Extensible automation Multiple device control
Develop an entire system of Python-based modules and programs for
controlling Android devices.
Developers can use the standard Python os and subprocess modules to
call Android tools such as Android Debug Bridge.
Multiple device control Functional testing Regression testing
Modules of Monkeyrunner(1)
MonkeyRunner: A class of utility methods for monkeyrunner
For connecting monkeyrunner to devices and emulators.
For creating UIs for Monkeyrunner programs.
MonkeyDevice: Represents a device or emulator.
For installing and uninstalling packages.
For starting an Activity.
For sending keyboard or touch events to an application.
Can also be used to run test packages.
Modules of Monkeyrunner(2)
MonkeyImage: Represents a screen capture image.
Converting bitmap images.
Comparing two MonkeyImage objects.
Writing images to files.
MonkeyRunner vs. Monkey Tool
Able to run on any emulator instance or on a device.
Write separate python script that can
install the program.
Generates events and sends them to
Take screenshot for checking the
Test for crash or not.
Sustainability, performance, pricing
Monkeyrunner is a build in tool, which is included in the android SDK
Hence, it’s stabile for android testing and the performance is food.
Also, it’s free since it comes with Android SDK tools.
Test program is implemented in Python.
Easy to learn.
Script is separate with the project files.
Able to test on multiple device and emulators at the same time.
Easy and powerful.
Multiple platform can handle MonkeyRunner.
Comes with Android SDK Tools.
Run on multiple devices and simulators.
Python is required.
Tutorial / Basic Steps
Installs an application or test package
Runs an application
Send keystrokes or touch events to it
Take screen shots of the user interface
Store screen shots on your workstation