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 查看当前运行的包名和


用Windows自带命令行进入ADB工具,输入以下命令即可免root实现神奇功能

1.电量显示:
adb shell content insert --uri content://settings/system --bind name:s:status_bar_show_battery_percent --bind value:i:1

2.全屏沉浸:
adb shell settings put global policy_control immersive.full=*

3.沉浸状态栏:
adb shell settings put global policy_control immersive.status=*

4.沉浸导航栏:
adb shell settings put global policy_control immersive.navigation=*

5.我们还可以单独控制哪些app不沉浸,例如以下代码设置google即时桌面不沉浸,其他程序沉浸:
adb shell settings put global policy_control immersive.full=apps,-com.google.android.googlequicksearchbox

6.如果想恢复到正常模式,运行下面的代码:
adb shell settings put global policy_control null

使用专用adb包已上传,获取请联系小编


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)无法搜索到上述信息出现这种情况,一般都是外界原因而非程序本身原因。比如电脑异常测试中断,需要重新测试。

Event percentage分析:

在上述过程中,使用了percent相关命令控制了事件类型,如果我们不指定事件类型。生成的报告中,事件占比大致如下:

// Event percentages:

// 0: 15.0%

// 1: 10.0%

// 2: 2.0%

// 3: 15.0%

// 4: -0.0%

// 5: 25.0%

// 6: 15.0%

// 7: 2.0%

// 8: 2.0%

// 9: 1.0%

// 10: 13.0%

这里将事件分为了10种类型,分别为:

0:触摸事件百分比,即参数--pct-touch

1:滑动事件百分比,即参数--pct-motion

2:缩放事件百分比,即参数--pct-pinchzoom

3:轨迹球事件百分比,即参数--pct-trackball

4:屏幕旋转事件百分比,

5:基本导航事件百分比,即参数--pct-nav

6:主要导航事件百分比,即参数--pct-majornav

7:系统事件百分比,即参数--pct-syskeys

8:Activity启动事件百分比,即参数--pct-appswitch

9:键盘翻转事件百分比,即参数--pct-flip

10:其他事件百分比,即参数--pct-anyevent

转载于:https://www.cnblogs.com/CS-zhanglu/p/9486986.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值