monkey亲测

打开终端:

adb devices  查看链接的设备

adb shell 进入手机系统

ls data/data 进入手机目录查看要执行目标app的包名

adb -s emulator-(机器名) shell monkey -v -p (包名) 500(500为事件数量)

只有一部机器 直接 

adb shell monkey -v -p com.iBer.iBerAppV2 100

 

比如只执行点击并把信息打印到txt文件里

adb shell monkey  --pct-touch 80 -v -p  com.ibroker.iBerHK   500  >/Users/kaibinliu/Desktop/monkey_log2.txt

 

 

---------分析-----

闪退

在报告里面查询 CRASH,底部会找到执行到那部报错了,seed值是多少

 

 

然后再把app切换到这个seed值动作开始的界面,执行这个seed值得动作

adb shell monkey  --pct-touch 80 -v -p  com.ibroker.iBerHK  -s 1547335869648  500  >/Users/kaibinliu/Desktop/monkey_log2.txt

 

 

后记:

有空的话可以搭配appium 加那个用例执行失败会自动截图的htmlrunner的框架 配合monkey 可以再闪退的时候 把闪退前的图片截取下来

原文地址:https://www.cnblogs.com/kaibindirver/p/10198453.html