22
Monkey Runner & Monkey Testing Author: Syeda Fatima Waseem

Monkey runner & Monkey testing

Embed Size (px)

DESCRIPTION

MonkeyRunner an API for writing programs that control an android device or emulator for automation testing. An intro to Monkey testing too. In next slide we will be sharing how to run the tool with an example too.

Citation preview

Page 1: Monkey runner & Monkey testing

Monkey Runner & Monkey Testing

Author: Syeda Fatima Waseem

Page 2: Monkey runner & Monkey testing

What is MonkeyRunner???

• It is a tool which provides an API for writing programs that control an android device or emulator

• It is a python based test tool, used to run python scripts for testing android applications

• It uses Jython, an implementation of python that uses the Java programming language

Page 3: Monkey runner & Monkey testing

Why MonkeyRunner is Used???

• It is primarily designed to test applications and devices at the functional level and for running unit/functional test suites

• It can be used to test an application against a random clicks on the application

Page 4: Monkey runner & Monkey testing

What you can do with MonkeyRunner???

• You can write python programs to test the applications on one or more devices and/or emulators

• You can do following things with monkeyrunner: 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

Page 5: Monkey runner & Monkey testing

Features of MonkeyRunner 1. Multiple device control:

• MonkeyRunner API can apply one or more test suites across multiple devices or emulators

• You can 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

Page 6: Monkey runner & Monkey testing

Features of MonkeyRunner

2. Functional Testing:

• MonkeyRunner can run an automated start-to-finish test of and Android application

• You can provide input values with keystrokes or touch events, and view the results as screenshots

Page 7: Monkey runner & Monkey testing

Features of MonkeyRunner

3. Regression Testing:

MonkeyRunner can test application stability by runningan application and comparing its output screenshots toa set of screenshots that are known to be correct

Page 8: Monkey runner & Monkey testing

Features of MonkeyRunner

4. Extensible Automation:

• As MonkeyRunner is an API toolkit, you can develop an entire system of Python-based modules and programs for controlling Android devices

Page 9: Monkey runner & Monkey testing

Modules of MonkeyRunner1. MonkeyRunner:

• A class of utility methods for monkeyrunner programs• This class provides a method for connecting monkeyrunner to a device

or emulator

2. MonkeyDevice: • Represents a device or emulator• This class provides methods for installing and uninstalling packages,

starting an Activity, and sending keyboard or touch events to an application

• You also use this class to run test packages

Page 10: Monkey runner & Monkey testing

Modules of MonkeyRunner

3. MonkeyImage: • Represents a screen capture image

• This class provides methods for capturing screens, converting bitmap images to various formats, comparing two MonkeyImage objects, and writing an image to a file

Page 11: Monkey runner & Monkey testing

MonkeyRunner Methods

Method Descriptionalert (string message, string title, string okTitle)

Displays an alert dialog to the process running the current program

choice(string message, iterable choices, string title)

Displays a dialog with a list of choices to the process running the current program

help (string format)

Displays the monkeyrunner API reference in a style similar to that of Python's pydoc tool

Page 12: Monkey runner & Monkey testing

MonkeyRunner Methods

Method Description

input (string message, string initialValue, string title, string okTitle, string cancelTitle)

Displays a dialog that accepts input

sleep (float seconds)

Pauses the current program for the specified number of seconds

waitForConnection float timeout, string deviceId)

Tries to make a connection between the monkeyrunner backend and the specified device or emulator

Page 13: Monkey runner & Monkey testing

Monkey Testing

Page 14: Monkey runner & Monkey testing

What is Monkey Testing???

• Word “Monkey” is used to refer a fully automated testing tool

• Monkey testing is a random testing performed by automated testing tools and has no fixed perspective for testing , so it performs mouse clicks on the screen or keystrokes on the keyboard randomly

• Testing is done randomly for judging that, accessing different functionalities is in coherence or is it showing any abnormality

Page 15: Monkey runner & Monkey testing

Why Monkey term is used???

• We call them “Monkey” because 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

• The name 'monkey' comes from the adage that ‘a thousand monkeys at a thousand typewriters will eventually type out the entire works of Shakespeare

Page 16: Monkey runner & Monkey testing

Types of Monkey Test

Monkey Testing

Dumb Monkey Testing

Smart Monkey Testing

Page 17: Monkey runner & Monkey testing

1. Dumb Monkey Testing

• Initial and the lowest level of testing service is called Dumb Monkey Testing

• Dumb monkey knows nothing about the software being tested, it just clicks or type randomly

• They are easy to write and can find serious, crashing bugs

Page 18: Monkey runner & Monkey testing

2. Smart Monkey Testing

• Having some experience and improved testing skills the Dumb Monkey reaches the next stage in evolution: Semi-Smart Monkey Testing

• Different levels of IQ in Semi-Smart Monkey testing: In low IQ testing, inputs would be generated independently i.e.

each input is considered independent of the other inputs In high IQ monkey testing, the correlation (e.g., the covariance)

between input distribution is taken into account

Page 19: Monkey runner & Monkey testing

Dumb Monkey Testing Advantages

• Find bugs even at the early stage of the development which saves testing time later and corrective actions are possible at the earliest possible time

• They are easy to write

• It can test continuously for several days, unless it encounters bugs or crash

• Will not find many bugs, but when it finally finds the bugs, it is most likely the major ones, hangs and crashes

• Easy to set up; can be used in any application

• Costs less than smart monkey

Page 20: Monkey runner & Monkey testing

Dumb Monkey Testing Disadvantages

• It is capable only of limited and basic tests

• “Educating” the dumb monkey further would make it less dumb, but would mean additional cost

Page 21: Monkey runner & Monkey testing

Smart Monkey Testing Advantages & Disadvantages

Advantages:• Capable of finding a significant number of bugs, if properly set up, with an accurate

state model• Valuable tool for load and stress testing

Disadvantages:• Costs more than the dumb monkey• Capability depends on the state model installed, the more the state models, the

more expensive will be the smart monkey

Page 22: Monkey runner & Monkey testing

[email protected]

+92-42-35782346

Contact Us

www.Twitter.com/SwaamTech

www.FaceBook.com/SwaamTech