monkey测试笔记

首先使用adb工具,与真机建立链接(最好使用真机测试):

monkey测试命令:

adb shell monkey -p com.hele.buyer -s 200 --throttle 250 --ignore-crashes --ignore-timeouts --ignore-security-exceptions --ignore-native-crashes --monitor-native-crashes -v -v -v 10000 > D:/monkeylog/1000-log.txt

常用命令:

1,adb devices 查看链接状态
2,adb shell 进入测试机中
3,adb shell dumpsys activity | findstr "mFocusedActivity" 获取当前运行的包名
4,adb shell dumpsys window | findstr mCurrentFocus 查看当前运行的包名和

Activity netstat -aon|findstr "5037" 查看被占用进程
taskkill /pid 3676 /f 杀死进程 强制退出monkey

1,adb shell
2,ps | grep monkey
3,kill 进程号

Monkey测试的og分析,我们可以通过几个关键词来判断测试是否通过:

1)Monkey finished打开LOG,查看log的最下端,是否有类似以下字段:## Network stats: elapsed time=5123ms (5123ms mobile, 0ms wifi, 0ms not connected)// Monkey finished这个字段表明本次的Monkey没有异常,测试通过。
2)CRASH同样,在得到LOG后,搜索”CRASH”字段,如果搜索到有结果,则表明有进程出现问题,测试不通过。// CRASH: com.onekchi.downloadmanager (pid 12919)
3)ANR在Log中搜素该字段,如果有搜索有结果,则表示测试过程中,测试对象出现了无响应的现象,因此测试不通过。--throttle <毫秒> 值建议为500
4)无法搜索到上述信息出现这种情况,一般都是外界原因而非程序本身原因。比如电脑异常测试中断,需要重新测试。

猜你喜欢

转载自www.cnblogs.com/CS-zhanglu/p/9486986.html