学习monkey压力测试

monkey压力测试

1,准备环境

Android sdk 和python

2,手机连接usb,开启调试模式

3,检查是否连接  adb devices

4,adb shell  monkey  1000 随机执行1000个指令

5,adb logcat | findstr START  获取app包名

6,指定的包名发送1000个指令    adb shell monkey  -p com.igrid.standardization 1000

7,指定事件之间的间隔   adb shell monkey  -p com.android.bbkcalculator --throttle 1000  100

8,指定随机生成的seed值 复现操作 adb shell monkey  -p com.igrid.standardization -s 1 1000

9,触摸事件  设计触摸事件百分比 adb shell monkey -v -p com.android.bbkcalculator  --pct-touch 50  --pct-motion 50 100

轨迹球事件:设定轨迹球事件百分比
           命令:adb shell monkey --pct-trackball<percent>
基本导航事件:输入设备的上下左右方向键的导航
           命令:adb shell monkey --pct-nav<percent>
主要导航事件:中间键、返回键、菜单按钮键
           命令:adb shell monkey --pct-majornav<percent>
系统导航事件:HOME键、BACK键、拨号、音量键
           命令:adb shell monkey --pct-syskeys<percent>
启动Activity事件:在已有的Activity之间进行切换
           命令:adb shell monkey --pct-appswitch<percent>
不常用事件:
           命令:adb shell monkey --pct-anyevent<percent>

10,  adb shell monkey  -p com.igrid.standardization  cc 10000

忽略崩溃和异常 --ignore-crashes<event-count>  adb shell monkey  -p com.igrid.standardization --throttle 1000  --ignore-crashes 10000

忽略超时事件 --ignore-timeouts<event-count>

11,查看anr日志

  1. adb shell   #进入手机系统

  2. cd /data/anr   #进入日志文件目录

  3. ls   #查看anr目录下文件

  4. more traces.txt   #查看日志  ll traces_com.mfc.zwjyproject.txt

12,monkeyrunner 

如果出现monkeyrunner 不是内部或外部命令,也不是可运行的程序 或批处理文件。

1,需要将D:\android-sdk-windows\tools\bin放入环境变量中。

2,记事本打开monkeyrunner.bat文件,修改红框里面的路径

3,在tools目录下新建framework文件夹,将 E:\sdk\platform-tools 目录下的adb.exe粘贴过去

4,编写python程序  

D:\android-sdk-windows\platform-tools\app.apk

 

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值