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:

Get Learning Android Application Testing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.