UI/Application Exerciser Monkey

    The Monkey is a command-line tool that you can run on any emulatorinstance or on a device. It sends a pseudo-random stream of user events into the system, which acts as a stress test on the application software you are developing.

    The Monkey includes a number of options, but they break down into four primarycategories:

    • Operational constraints, such as restricting the test to a single package.
    • Event types and frequencies.
    • Debugging options.
      When the Monkey runs, it generates events and sends them to the system. It also _watches_the system under test and looks for three conditions, which it treats specially:

    • If your application crashes or receives any sort of unhandled exception, the Monkey will stop and report the error.
    • If your application generates an application not responding error, the Monkey will stop and report the error.
      Depending on the verbosity level you have selected, you will also see reports on the progressof the Monkey and the events being generated.

    You can launch the Monkey using a command line on your development machine or from a script. Because the Monkey runs in the emulator/device environment, you must launch it from a shell in that environment. You can do this by prefacing to each command, or by entering the shell and entering Monkey commands directly.

    The basic syntax is:

    With no options specified, the Monkey will launch in a quiet (non-verbose) mode, and will send events to any (and all) packages installed on your target. Here is a more typical command line,which will launch your application and send 500 pseudo-random events to it:

    1. $ adb shell monkey -p your.package.name -v 500

    The table below lists all options you can include on the Monkey command line.