【Monkey】Android压力测试

一、简单介绍一下Monkey

Monkey工具直接运行在设备或模拟器的adb shell中,生成用户或系统的伪随机事件流

二、Monkey命令

1、adb shell monkey -p package 事件数(50)

# 随机完成50个事件

adb shell monkey -p com.xxx.xxx 50

 

2、throttle参数---指定事件之间的间隔

adb shell monkey --throttle 间隔毫秒数

随机完成50个事件,时间间隔1s

adb shell monkey -p com.xxx.xxx --throttle 1000 50

 

3、seed参数 ---指定随机生成数seed值(-s就是seed)

adb shell monkey -s<seed> 100(seed值)

随机完成50个事件,seed值100(只要seed值相同,最终执行顺序是一样的)

adb shell monkey -p com.xxx.xxx -s 100 50

 

4、触摸事件---设定点击事件百分比

adb shell monkey -p com.xxx.xxx --pct-touch<percent>

随机完成50个事件,点击事件100%,

adb shell monkey -p com.xxx.xxx --pct-touch 100 50

-v会把完成的所有事件的详情列出来,-v表示输出日志的级别,有-v、-v-v、-v-v-v三个级别,v越多,日志越详细

adb shell monkey -v -p com.xxx.xxx --pct-touch 100 50

 

5、动作事件---设定动作事件百分比

adb shell monkey -p com.xxx.xxx --pct-motion<percent>

6、轨迹球事件---设定轨迹球事件百分比

adb shell monkey -p com.xxx.xxx  --pct-trackball<percent>

7、基本导航事件---设定基本导航事件百分比,输入设备的上下左右

adb shell monkey -p com.xxx.xxx  --pct-nav<percent>

8、主要导航事件---兼容中间键、返回键、菜单按键

adb shell monkey -p com.xxx.xxx  --pct-majornav<percent>

9、系统导航事件---HOME、音量、BACK、拨号键

adb shell monkey -p com.xxx.xxx  --pct-syskeys<percent>

10、切换Activity事件

adb shell monkey -p com.xxx.xxx  --pct-appswitch<percent>

11、不常用事件

adb shell monkey -p com.xxx.xxx  --pct-anyevent<percent>

 

12、崩溃事件---忽略崩溃和异常

adb shell monkey -p com.xxx.xxx  --ignore-carshes<event-count>

13、超时事件--忽略超时事件

adb shell monkey -p com.xxx.xxx   --ignore-timeouts<event-count>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值