一、环境配置
1、sdk环境
2、python环境
下载地址:https://www.python.org/downloads/
二、压力步骤
1、确认手机和电脑已经连接成功 adb devices
2、安装测试App 把需要测试的应用安装到手机上。
3、获取应用包名 adb shell dumpsys window | findstr mCurrentFocus
4、指定包打压力 adb shell monkey -p 包名 1000
三、常用指令
1、throttle延迟1s执行事件
adb shell monkey -p 包名 -throttle 1000(延迟的时间) 10(执行事件)
2、seed序列,指定随机序列,只要这个值相等,执行的步骤都相同
adb shell monkey -p 包名 -s 100 10
3、遇到崩溃,继续执行事件
adb shell monkey -p 包名 --ignore-crashes 1000
4、--ignore-timeouts ANR超时继续运行
四、收集崩溃日志
1、搜索报告中的关键字“ANR”,看有无应用无响应的事件(Application Not Responding)
2、搜索报告中的关键字“crash”,看有无崩溃的事件
3、搜索报告中的关键字“exception”,看有无其他异常事件。(如果出现空指针, NullPointerException,需格外重视)