Tuesday, December 22, 2015

How to install monkey Runner and work on it.

1.monkeyrunner

monkeyrunner is a automation tool which provides us to conduct BlackBox testing on android applications.
The monkeyrunner tool provides a Python API for writing programs that control an Android device or emulator from outside of Android code. With monkeyrunner, you can write a Python program that installs an Android application or test package, runs it, sends keystrokes to it, takes screenshots of its user interface, and stores screenshots on the workstation.
The monkeyrunner tool is primarily designed to test applications and devices at the functional/framework level and for running unit test suites, but you are free to use it for other purposes.

2.What all we need before we get it started?

We need the below:

1. Windows 7/8 OS
2. Java 6
3. Eclipse
4. Android device running min android version 2.3.4
5. Python
6. Jython
7. Application to be tested

3.How to setup monkeyrunner in Eclipse?

1. First download Python from this site: http://www.python.org/getit/
2. Second download Jython.jar file from this site: http://www.jython.org/downloads.html
3. Download the Jython Installer from this site: https://wiki.python.org/jython/DownloadInstructions
3. After downloading the above files install Python.

4. Basic Install for Jython:

After downloading Jython installer, either double click the jython_installer-
2.5.2.jar
or run java with the -jar option Quote:

java -jar jython_installer-2.5.2.jar

5. Now after completion of this we will move to Eclipse and download PyDev from Eclipse market place as shown below:

6. When finished install, Go to Window->Preferences->PyDev->Interpreters - Jython interpreters : Click [new...] and got o the path where you have installed Jython.

For me it is at C:/jython/jython.jar - Libraries : Click [New Jar/Zip(s)] and enter your ANDROID_SDK_PATH/tools/lib/monkeyrunner.jar as shown below:

7. After this Go to Window->Preferences->PyDev->Interpreters-> - Python interpreters :

Click [new...] and got o the path where you have installed Python.
For me it is at C:/Python33/python.jar as shown below:

4. How to write and execute monkeyrunner Script? 1. Go to File-> New -> PyDev Project -> Give any project Name and select Jython as shown below:

2. Now right click on the newly created project -> New -> PyDev Module

3. Give any Name to the project but leave the package field empty as shown below:

No comments :

Post a Comment