How to setting Android's MonkeyRunner for Eclipse

Date : Sat,2 Fabuary 2013
Writer : Ataya P

Monkey Runner Testing
Working Platform :
Lenovo Notebook , Intel Pentium Dual Core T2080 1.73GHz
2Gbyte RAM
Ubuntu  12.04.1 LTS- Precise Pangolin

- Eclipse (For my case, Eclipse Indigo)
- Android SDK installed

Hardware :
Your Android Phone ( For my case, Galaxy Nexus) connect via usb cable with your PC.


     Now I tried to using MonkeyRunner for automatic application testing that working on Android phone. It's free and comes with the Android SDK itself. The working script was writen in Python(using Jython interpreter) I successfully setting the development environment on the Eclipse IDE … and I will show you how to do that.

Let's do it
1. Run Eclipse. Open Help-> Eclipse MarketPlace and search for PyDev then install it.
Install PyDev

2.When finished install, Go to Window->Preferences->PyDev->Interpreter-Jython and setting 2 jar files
       - Jython interpreters : Click [new...] and enter your ANDROID_SDK_PATH/tools/lib/jython.jar
       - Libraries : Click [New Jar/Zip(s)] and enter your ANDROID_SDK_PATH/tools/lib/monkeyrunner.jar
Add Library

3.Create new PyDev project.
create new project

4.Select project type as Jython, grammar version 2.5 and click finish button.
Project set up

5.Add your test script and folder for saving capture screens
Add test script and capture screen folder

6.Open external tools configurations and add new configuration as below...
        - Location: select your ANDROID_SDK_FOLDER/tools/monkeyrunner
        - Working Directory : Select your working PyDev project directory.
        - Argument: Write down your test script file name.

external tool setting

7.Click on Run External Tools button and run the test script the phone should show the app and the screep capture stored inside the folder.

the app started up  screen captured

Useful Link :
About Monkey Runner ->

Custom Search