Skip to main content
Does Monkey Runner suffice for test automation of android mobile Apps- (2)

Does Monkey Runner suffice for test automation of Android Mobile Apps?

There are many automation tools out there in the market for testing android mobile applications.  The one which comes along with Android SDK is called the Monkey Runner.

What is MonkeyRunner?

It is a tool which provides APIs/functions for writing programs for controlling an android device or emulator.  It uses Jython, an implementation of Python that uses Java programming language. 

It is primarily designed to test android mobile applications on emulator and devices to perform functional and regression testing.

Why Monkey name?

It is widely believed that if we allow six monkeys to pound on six typewriters at random, for a million years, they will recreate all the works of Isaac Asimov, a well-known author in America!!!

Also there is an adage like ‘a thousand monkeys at a thousand typewriters will eventually type out the entire works of Shakespeare’ J

What you can do with MonkeyRunner

You can write python scripts to test the applications on one or more connected devices and/or emulators. You can do the following things with monkey runner

  1. Install an application or test package
  2. Run an application
  3. Invoke an activity
  4. Send keystrokes or touch events to it
  5. Wake the screen/device
  6. Take screen shots of the user interface
  7. Store screen shots on your workstation
  8. Compare two screen shots taken using the tool

While writing python script for monkey runner, programmers find it very difficult to get the accurate touch points of controls on screen to send touch events. For this purpose, Android SDK provides another tool called ‘Hierarchy Viewer’.  This tool provides coordinates of any point on the device screen.


Significant disadvantage of this MonkeyRunner mobile application testing tool is that it is necessary to write scripts for each device. Another problem is that the tests require adjustments each time when user interface of the tested program is changed.

Also, Monkey runner cannot read text from the device though there is an extension of which is available. It is called EasyMonkeyDevice which is not officially documented by google.

In addition to that Monkey runner APIs can be extended to write user specific logic for their requirements.

Technical components

  1. Eclipse IDE
  2. Android SDK
  3. Android Debug Bridge
  4. Android Package (APK) for the application to be tested
  5. Android device connected through USB (or emulator)
  6. Android drivers for specific device installed on computer


On an ending note, if we are interested in automating the testing process which involves only the basic level testing and need a cost effective automation tool, definitely Monkey runner can be considered.

Prasenjit Bala

Prasenjit Bala

Sr. Software Engineer at Trigent with 5+ years of experience in mobile application development. Holds master's degree in computer applications(MCA) from West Bengal University of Technology(WBUT).