通过monkey测试特定的App
通过monkey可以测试特定的app,基础语法如下:
adb shell monkey [options] 200
回顾通过uiautomator 去查看某个应用的包名。如qq包名:com.tencent.mobileqq 微信包名:com.tencent.mm
参数-p,如
adb shell monkey –p com.tencent.mobileqq 100
如果说同时操纵2个应用
adb shell monkey –p com.tencent.mobileqq -p com.tencent.mm 500
#同时启动了微信与qq
Activity涉及到类,与开发人员息息相关。而自动化测试工程师未必知道,因此使用率并不高
参数 –c,格式:
adb shell monkey -c
adb shell monkey --ignore-crashes
adb shell monkey --ignore-timeouts
adb shell monkey --ignore-security-exceptions
案例:
以腾讯qq为例进行测试,通过monkey对qq进行随机操作测试。
要求:
Monkey脚本:
C:\Users\Leo>adb shell monkey -p com.tencent.mobileqq --pct-touch 40 --pct-motion 25 --pct-appswitch 15 --pct-rotation 10 -s 1000 --throttle 300 --ignore-crashes --ignore-timeouts -v -v 200

如果你觉的文章读的不过瘾,可以查看详细的视频教程。


