Stability control of Android Monkey behavior

I had a problem with Android Monkey which the Monkey mimicked random patterns of events while this behavior prevent my system’s results to be same all the time. The fact is that by default Monkey sends pseudo-random stream of user events to the system. This behaviar may cause difficulties for developers who wants to practice a series of expected user events with the least randomization.

Well, it is possible to define the randomization seed which can almost trigger similar sequence of actions. In addition you can decide what types of event (Touche, Motion, Trackball or Navigation) are going to be send.

For example

adb shell monkey s 10 --pct-touch 60 --pct-motion 40 -p 200

will send 200 events to the app which contains 60% touch and 40% motion events to the system while the variables are using randomized values with the define seed of 10.

In my own case, I used an additional time interval to make it even more predictable as:

adb shell monkey -s 10 --throttle 1000 --pct-touch 100 -p 20

which will send 20 event with intervals of 1000ms. This makes it easier to predict what is going on with the system so we can perform automated debugging in more convenient way (in this case you can expect a run time of 20 seconds in which one touch will be send every second).

Monkey Reference:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s