ADB Shell Monkey Command

本文详细介绍了MonkeyCommands工具的使用方法及参数设置。通过Adbshellmonkey命令可以进行Android应用的压力测试,包括触摸事件百分比、运动事件百分比等,并提供了一系列选项来定制测试行为。文章还解释了如何忽略崩溃和超时等问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Monkey Commands

Adb shell monkey –p <package_name>
usage: monkey [-p ALLOWED_PACKAGE [-p ALLOWED_PACKAGE] ...]
              [-c MAIN_CATEGORY [-c MAIN_CATEGORY] ...]
              [--ignore-crashes] [--ignore-timeouts]
              [--ignore-security-exceptions]
              [--monitor-native-crashes] [--ignore-native-crashes]
              [--kill-process-after-error] [--hprof]
              [--pct-touch PERCENT] [--pct-motion PERCENT]
              [--pct-trackball PERCENT] [--pct-syskeys PERCENT]
              [--pct-nav PERCENT] [--pct-majornav PERCENT]
              [--pct-appswitch PERCENT] [--pct-flip PERCENT]
              [--pct-anyevent PERCENT] [--pct-pinchzoom PERCENT]
              [--pkg-blacklist-file PACKAGE_BLACKLIST_FILE]
              [--pkg-whitelist-file PACKAGE_WHITELIST_FILE]
              [--wait-dbg] [--dbg-no-events]
              [--setup scriptfile] [-f scriptfile [-f scriptfile] ...]
              [--port port]
              [-s SEED] [-v [-v] ...]
              [--throttle MILLISEC] [--randomize-throttle]
              [--profile-wait MILLISEC]
              [--device-sleep-time MILLISEC]
              [--randomize-script]
              [--script-log]
              [--bugreport]
              [--periodic-bugreport]
              COUNT

–throttle delay between each action.
-s (seed) which use to generate random actions, if two command with same seed value, the actions order will be same. It can be used to repro the issue with same actions. The output of two monkey commands will be same if set seed value as same.
–pct-touch percent of touching. Click event.
–pct-motion action event.
–pct-trackball.
–pct-nav basic navigation, using up, down, left and right in the input device.
–pct-majornav back, menu, and OK(middle) key and soft navigation keys.
–pct-syskeys System navigation: HOME, BACK, Volume, Phone Call key, hard keys.
–pct–appswitch Start activity event. Switch activity in the app.

–pct-anyevent any event.
–ignore-crashes ignore crashes and exception. CRASH in monkey log.
–ignore-timeouts ignore ANR and continue actions. ANR log filter in monkey log is “ANR in “. CPU, memory, exception information will be displayed in the following log.
Monkey will stop when meet crash and ANR.

Repeatable scenarios (serial actions):
Adb shell monkey –f
-v list all actions has been executed.
// Event percentages:
// 0: 20.0% –pct-touch
Percent of touch, different types of click event.
ACTION_UP, ACTION_DOWN, ACTION_MOVE (Trackball), Rotation.
// 1: 20.0% –pct-motion
Action event.
// 2: 0.0%
// 3: 0.0%
// 4: -0.0%
// 5: 30.0%
// 6: 30.0%
// 7: 0.0%
// 8: 0.0%
// 9: 0.0%
// 10: 0.0%

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值