Book Image

Learning Android Application Testing

Book Image

Learning Android Application Testing

Overview of this book

Table of Contents (16 chapters)
Learning Android Application Testing
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Running monkey


You might know about the infinite monkey theorem. This theorem states that a monkey that hits keys at random on a typewriter keyboard for an infinite amount of time will eventually type a given text, such as the complete works of William Shakespeare. The Android version of this theorem states that a monkey that produces random touches on a device could crash your application in, well, much less than an infinite amount of time.

With this, Android features a monkey application (http://goo.gl/LSWg85) that will generate the random events instead of a real monkey.

The simplest way to run monkey against our application to generate random events is:

$ adb -e shell monkey -p com.blundell.tut -v -v 1000

You will be receiving this output:

Events injected: 1000
:Sending rotation degree=0, persist=false
:Dropped: keys=0 pointers=4 trackballs=0 flips=0 rotations=0
## Network stats: elapsed time=2577ms (0ms mobile, 0ms wifi, 2577ms not connected)
// Monkey finished

The monkey will send events...