SlideShare a Scribd company logo
MonkeyRunner
Author: Lijie Xia
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
testing.



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



Functional testing



Regression testing



Extensible automation
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

Next Topic
Functional Testing


Monkeyrunner can run an automated start-to-finish test of an Android
application.



Programmers provide input values with keystrokes or touch events



Monkeyrunner takes screenshots to show the results.

Multiple device control Regression testing Extensible automation

Next Topic
Regression Testing


Test application stability by running an application and comparing its
output screenshots to a set of screenshots that are known to be
correct.

Functional testing Extensible automation Multiple device control

Next Topic
Extensible Automation


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

Next Topic
Modules of Monkeyrunner(1)


MonkeyRunner: A class of utility methods for monkeyrunner
programs.





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.


Capturing screens.



Converting bitmap images.



Comparing two MonkeyImage objects.



Writing images to files.
MonkeyRunner vs. Monkey Tool


Similarity:




Able to run on any emulator instance or on a device.

Difference:

MonkeyRunner

Monkey Tool

Write separate python script that can
install the program.

Generates events and sends them to
the system

Take screenshot for checking the
correctness

Test for crash or not.
Sustainability, performance, pricing


Monkeyrunner is a build in tool, which is included in the android SDK
tools.



Hence, it’s stabile for android testing and the performance is food.



Also, it’s free since it comes with Android SDK tools.
Benefit/Cost Analysis


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.
Compatibility


Multiple platform can handle MonkeyRunner.



Comes with Android SDK Tools.



Run on multiple devices and simulators.



Python is required.
Sample Code Tutorial
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
Reference


http://developer.android.com/tools/help/monkeyrunner_concepts.html



http://androidtesting.blogspot.com/2012/03/android-testing-withmonkeyrunner.html



http://androidtesting.blogspot.com/2012/04/monkeyrunner-tutorial-runningtests-on.html



http://antoine-merle.com/introduction-to-the-monkey-runner-tool-2/



http://developer.android.com/tools/help/monkey.html

More Related Content

What's hot

Android Testing: An Overview
Android Testing: An OverviewAndroid Testing: An Overview
Android Testing: An Overview
SmartLogic
 
Unit Testing Using Mockito in Android (1).pdf
Unit Testing Using Mockito in Android (1).pdfUnit Testing Using Mockito in Android (1).pdf
Unit Testing Using Mockito in Android (1).pdf
Katy Slemon
 
Dagger for android
Dagger for androidDagger for android
Dagger for android
Kan-Han (John) Lu
 
Android testing part i
Android testing part iAndroid testing part i
Android testing part i
Kan-Han (John) Lu
 
Testing Native Apps at PAYBACK
Testing Native Apps at PAYBACKTesting Native Apps at PAYBACK
Testing Native Apps at PAYBACK
Marcel Gehlen
 
Android testing
Android testingAndroid testing
Android testing
JinaTm
 
Monkey Talk
Monkey TalkMonkey Talk
Monkey Talk
Jignesh Bhadani
 
See test
See testSee test
See test
Vivek Shringi
 
Android testing
Android testingAndroid testing
Android testing
Bitbar
 
Exploiting the Saturation Effect in Automatic Random Testing of Android Appli...
Exploiting the Saturation Effect in Automatic Random Testing of Android Appli...Exploiting the Saturation Effect in Automatic Random Testing of Android Appli...
Exploiting the Saturation Effect in Automatic Random Testing of Android Appli...
REvERSE University of Naples Federico II
 
How to configure monkey talk android agent
How to configure monkey talk android agentHow to configure monkey talk android agent
How to configure monkey talk android agent
Dasun Eranthika
 
AGRippin: A Novel Search Based Testing Technique for Android Applications
AGRippin: A Novel Search Based Testing Technique for Android ApplicationsAGRippin: A Novel Search Based Testing Technique for Android Applications
AGRippin: A Novel Search Based Testing Technique for Android Applications
REvERSE University of Naples Federico II
 
08 objective-c session 8
08  objective-c session 808  objective-c session 8
08 objective-c session 8
Amr Elghadban (AmrAngry)
 
A Toolset for GUI Testing of Android Applications
A Toolset for GUI Testing of Android ApplicationsA Toolset for GUI Testing of Android Applications
A Toolset for GUI Testing of Android Applications
Porfirio Tramontana
 
Appium an introduction
Appium   an introductionAppium   an introduction
Appium an introduction
Vivek Shringi
 
Monkey talk
Monkey talkMonkey talk
Monkey talk
Confiz
 
A technique for parallel gui testing of android applications
A technique for parallel gui testing of android applicationsA technique for parallel gui testing of android applications
A technique for parallel gui testing of android applications
Porfirio Tramontana
 
100 effective software testing tools that boost your Testing
100 effective software testing tools that boost your Testing100 effective software testing tools that boost your Testing
100 effective software testing tools that boost your Testing
BugRaptors
 
Considering Context Events in Event-Based Testing of Mobile Applications
Considering Context Events in Event-Based Testing of Mobile Applications Considering Context Events in Event-Based Testing of Mobile Applications
Considering Context Events in Event-Based Testing of Mobile Applications
Porfirio Tramontana
 
Appium@Work at PAYBACK
Appium@Work at PAYBACKAppium@Work at PAYBACK
Appium@Work at PAYBACK
Marcel Gehlen
 

What's hot (20)

Android Testing: An Overview
Android Testing: An OverviewAndroid Testing: An Overview
Android Testing: An Overview
 
Unit Testing Using Mockito in Android (1).pdf
Unit Testing Using Mockito in Android (1).pdfUnit Testing Using Mockito in Android (1).pdf
Unit Testing Using Mockito in Android (1).pdf
 
Dagger for android
Dagger for androidDagger for android
Dagger for android
 
Android testing part i
Android testing part iAndroid testing part i
Android testing part i
 
Testing Native Apps at PAYBACK
Testing Native Apps at PAYBACKTesting Native Apps at PAYBACK
Testing Native Apps at PAYBACK
 
Android testing
Android testingAndroid testing
Android testing
 
Monkey Talk
Monkey TalkMonkey Talk
Monkey Talk
 
See test
See testSee test
See test
 
Android testing
Android testingAndroid testing
Android testing
 
Exploiting the Saturation Effect in Automatic Random Testing of Android Appli...
Exploiting the Saturation Effect in Automatic Random Testing of Android Appli...Exploiting the Saturation Effect in Automatic Random Testing of Android Appli...
Exploiting the Saturation Effect in Automatic Random Testing of Android Appli...
 
How to configure monkey talk android agent
How to configure monkey talk android agentHow to configure monkey talk android agent
How to configure monkey talk android agent
 
AGRippin: A Novel Search Based Testing Technique for Android Applications
AGRippin: A Novel Search Based Testing Technique for Android ApplicationsAGRippin: A Novel Search Based Testing Technique for Android Applications
AGRippin: A Novel Search Based Testing Technique for Android Applications
 
08 objective-c session 8
08  objective-c session 808  objective-c session 8
08 objective-c session 8
 
A Toolset for GUI Testing of Android Applications
A Toolset for GUI Testing of Android ApplicationsA Toolset for GUI Testing of Android Applications
A Toolset for GUI Testing of Android Applications
 
Appium an introduction
Appium   an introductionAppium   an introduction
Appium an introduction
 
Monkey talk
Monkey talkMonkey talk
Monkey talk
 
A technique for parallel gui testing of android applications
A technique for parallel gui testing of android applicationsA technique for parallel gui testing of android applications
A technique for parallel gui testing of android applications
 
100 effective software testing tools that boost your Testing
100 effective software testing tools that boost your Testing100 effective software testing tools that boost your Testing
100 effective software testing tools that boost your Testing
 
Considering Context Events in Event-Based Testing of Mobile Applications
Considering Context Events in Event-Based Testing of Mobile Applications Considering Context Events in Event-Based Testing of Mobile Applications
Considering Context Events in Event-Based Testing of Mobile Applications
 
Appium@Work at PAYBACK
Appium@Work at PAYBACKAppium@Work at PAYBACK
Appium@Work at PAYBACK
 

Similar to Lijie xia lx223809 monkeyrunner

Introduction To Mobile-Automation
Introduction To Mobile-AutomationIntroduction To Mobile-Automation
Introduction To Mobile-Automation
Mindfire Solutions
 
SE2011_10.ppt
SE2011_10.pptSE2011_10.ppt
SE2011_10.ppt
MuhammedAlTijaniMrja
 
Andriod dev toolbox part 2
Andriod dev toolbox  part 2Andriod dev toolbox  part 2
Andriod dev toolbox part 2
Shem Magnezi
 
Android automation tools
Android automation toolsAndroid automation tools
Android automation tools
SSGMCE SHEGAON
 
What Are Virtual Devices And How To Use Them For Testing.pdf
What Are Virtual Devices And How To Use Them For Testing.pdfWhat Are Virtual Devices And How To Use Them For Testing.pdf
What Are Virtual Devices And How To Use Them For Testing.pdf
pCloudy
 
iOS Application Testing
iOS Application TestingiOS Application Testing
iOS Application Testing
Mreetyunjaya Daas
 
DEPLOYMENT OF CALABASH AUTOMATION FRAMEWORK TO ANALYZE THE PERFORMANCE OF AN ...
DEPLOYMENT OF CALABASH AUTOMATION FRAMEWORK TO ANALYZE THE PERFORMANCE OF AN ...DEPLOYMENT OF CALABASH AUTOMATION FRAMEWORK TO ANALYZE THE PERFORMANCE OF AN ...
DEPLOYMENT OF CALABASH AUTOMATION FRAMEWORK TO ANALYZE THE PERFORMANCE OF AN ...
Journal For Research
 
Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appium
Pratik Patel
 
Ian Sommerville, Software Engineering, 9th EditionCh 8
Ian Sommerville,  Software Engineering, 9th EditionCh 8Ian Sommerville,  Software Engineering, 9th EditionCh 8
Ian Sommerville, Software Engineering, 9th EditionCh 8
Mohammed Romi
 
SDET UNIT 4.pptx
SDET UNIT 4.pptxSDET UNIT 4.pptx
SDET UNIT 4.pptx
PallawiBulakh1
 
Testing
Testing Testing
Testing
vamshi batchu
 
5 Popular Test Automation Tools For React Native Apps.pdf
5 Popular Test Automation Tools For React Native Apps.pdf5 Popular Test Automation Tools For React Native Apps.pdf
5 Popular Test Automation Tools For React Native Apps.pdf
flufftailshop
 
WinRunner Training
WinRunner TrainingWinRunner Training
WinRunner Training
sunny.deb
 
JUnit with_mocking
JUnit with_mockingJUnit with_mocking
JUnit with_mocking
Zeeshan Khan
 
Building And Executing Test Cases with Appium and Various Test Frameworks.pdf
Building And Executing Test Cases with Appium and Various Test Frameworks.pdfBuilding And Executing Test Cases with Appium and Various Test Frameworks.pdf
Building And Executing Test Cases with Appium and Various Test Frameworks.pdf
pCloudy
 
Unit Testing to Support Reusable for Component-Based Software Engineering
Unit Testing to Support Reusable for Component-Based Software EngineeringUnit Testing to Support Reusable for Component-Based Software Engineering
Unit Testing to Support Reusable for Component-Based Software Engineering
ijtsrd
 
Espresso
EspressoEspresso
Espresso
kanthivel
 
Ch8
Ch8Ch8
Ch8
Ch8Ch8
Testing concepts
Testing conceptsTesting concepts
Testing concepts
sangamesh kumbar
 

Similar to Lijie xia lx223809 monkeyrunner (20)

Introduction To Mobile-Automation
Introduction To Mobile-AutomationIntroduction To Mobile-Automation
Introduction To Mobile-Automation
 
SE2011_10.ppt
SE2011_10.pptSE2011_10.ppt
SE2011_10.ppt
 
Andriod dev toolbox part 2
Andriod dev toolbox  part 2Andriod dev toolbox  part 2
Andriod dev toolbox part 2
 
Android automation tools
Android automation toolsAndroid automation tools
Android automation tools
 
What Are Virtual Devices And How To Use Them For Testing.pdf
What Are Virtual Devices And How To Use Them For Testing.pdfWhat Are Virtual Devices And How To Use Them For Testing.pdf
What Are Virtual Devices And How To Use Them For Testing.pdf
 
iOS Application Testing
iOS Application TestingiOS Application Testing
iOS Application Testing
 
DEPLOYMENT OF CALABASH AUTOMATION FRAMEWORK TO ANALYZE THE PERFORMANCE OF AN ...
DEPLOYMENT OF CALABASH AUTOMATION FRAMEWORK TO ANALYZE THE PERFORMANCE OF AN ...DEPLOYMENT OF CALABASH AUTOMATION FRAMEWORK TO ANALYZE THE PERFORMANCE OF AN ...
DEPLOYMENT OF CALABASH AUTOMATION FRAMEWORK TO ANALYZE THE PERFORMANCE OF AN ...
 
Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appium
 
Ian Sommerville, Software Engineering, 9th EditionCh 8
Ian Sommerville,  Software Engineering, 9th EditionCh 8Ian Sommerville,  Software Engineering, 9th EditionCh 8
Ian Sommerville, Software Engineering, 9th EditionCh 8
 
SDET UNIT 4.pptx
SDET UNIT 4.pptxSDET UNIT 4.pptx
SDET UNIT 4.pptx
 
Testing
Testing Testing
Testing
 
5 Popular Test Automation Tools For React Native Apps.pdf
5 Popular Test Automation Tools For React Native Apps.pdf5 Popular Test Automation Tools For React Native Apps.pdf
5 Popular Test Automation Tools For React Native Apps.pdf
 
WinRunner Training
WinRunner TrainingWinRunner Training
WinRunner Training
 
JUnit with_mocking
JUnit with_mockingJUnit with_mocking
JUnit with_mocking
 
Building And Executing Test Cases with Appium and Various Test Frameworks.pdf
Building And Executing Test Cases with Appium and Various Test Frameworks.pdfBuilding And Executing Test Cases with Appium and Various Test Frameworks.pdf
Building And Executing Test Cases with Appium and Various Test Frameworks.pdf
 
Unit Testing to Support Reusable for Component-Based Software Engineering
Unit Testing to Support Reusable for Component-Based Software EngineeringUnit Testing to Support Reusable for Component-Based Software Engineering
Unit Testing to Support Reusable for Component-Based Software Engineering
 
Espresso
EspressoEspresso
Espresso
 
Ch8
Ch8Ch8
Ch8
 
Ch8
Ch8Ch8
Ch8
 
Testing concepts
Testing conceptsTesting concepts
Testing concepts
 

Lijie xia lx223809 monkeyrunner