Example for using monkey command with almost all options in android

swagatika picture swagatika · Jul 15, 2015 · Viewed 16.8k times · Source

I started to learn adb shell monkey command for testing an Android app through develoers.android.com website. However, I was able to figure out example for options v and s (seed). I need to use other options to control the touch inputs to the app with available options. I searched for examples/samples/guide to use the command in full fledge, resulted in none. If any of the developers is aware of using the command with all the options, please let me know.

Google search says,

adb shell monkey -p <package_name> -v n -s SEED

I am trying to figure out how to use -s option to control touch inputs. Any help or direction to know this will help me a lot.

Answer

Thupten picture Thupten · Jul 15, 2015

If you want to control where to click on the screen then you need monkeyrunner. monkeyrunner is an api not a command. You can create a python script or java program to automate series of events.

http://developer.android.com/tools/help/monkeyrunner_concepts.html

With monkey command, you can increase the probability of certain events with percent value.

adb shell monkey -p your.package.name --pct-appswitch 75 -v 500

--pct-syskeys Adjust percentage of "system" key events. (These are keys that are generally reserved for use by the system, such as Home, Back, Start Call, End Call, or Volume controls.) More options at http://developer.android.com/tools/help/monkey.html