Category Archives: Android Monkey Syntax

Monkey Script: the ‘Tap’ command

Per the source code, “tap” is a supported command, however it doesn’t really go much.

With my testing I found that the “tap” does not work for tapping keys..  The field I am highlighting has an attached keyboard, however “tap(5)” does not type a “5” on the keyboard.  All tap does, is if a field is in focus, and you “tap” it, the associated popup keyboard will appear.

Source Code (Look for EVENT_KEYWORD_TAP):

Android Monkey Scripting Language

Monkey:  The Monkey is a program that runs on your emulator or device and generates pseudo-random streams of user events such as clicks, touches, or gestures, as well as a number of system-level events. You can use the Monkey to stress-test applications that you are developing, in a random yet repeatable manner.

The code behind Monkey – as in the source code that runs these commands:

The Commands:

count= number of events

speed= in ms

start data >>

DispatchPointer(long downTime,  long eventTime, int action,

float x, float y, float pressure, float size, int metaState,

float xPrecision, float yPrecision, int device, int edgeFlags)

DispatchTrackball same as DispatchPointer

DispatchKey(long downTime, long eventTime, int action, int code,

int repeat, int metaState, int device, int scancode)

DispatchFlip(boolean keyboardOpen)

DispatchPress(int keyCode)


LaunchActivity(String pkg_name, String cl_name)

UserWait(long sleeptime)