monkey稳定性测试

稳定性测试定义:是指软件长时间的持续运行,系统版本是否稳定,是否持续的为客户提供服务。
指标:异常的次数,异常的频率
稳定性如何实施?
使用monkey向系统发送随机的用户事件流,实现对正在开发的应用程序进行稳定性测试,更好的模拟用户操作

adb shell monkey可以查看所有的命令
usage: monkey [-p ALLOWED_PACKAGE [-p ALLOWED_PACKAGE] …]
[-c MAIN_CATEGORY [-c MAIN_CATEGORY] …]
[–ignore-crashes] [–ignore-timeouts]
[–ignore-security-exceptions]
[–monitor-native-crashes] [–ignore-native-crashes]
[–kill-process-after-error] [–hprof]
[–match-description TEXT]
[–pct-touch PERCENT] [–pct-motion PERCENT]
[–pct-trackball PERCENT] [–pct-syskeys PERCENT]
[–pct-nav PERCENT] [–pct-majornav PERCENT]
[–pct-appswitch PERCENT] [–pct-flip PERCENT]
[–pct-anyevent PERCENT] [–pct-pinchzoom PERCENT]
[–pct-permission PERCENT]
[–pkg-blacklist-file PACKAGE_BLACKLIST_FILE]
[–pkg-whitelist-file PACKAGE_WHITELIST_FILE]
[–wait-dbg] [–dbg-no-events]
[–setup scriptfile] [-f scriptfile [-f scriptfile] …]
[–port port]
[-s SEED] [-v [-v] …]
[–throttle MILLISEC] [–randomize-throttle]
[–profile-wait MILLISEC]
[–device-sleep-time MILLISEC]
[–randomize-script]
[–script-log]
[–bugreport]
[–periodic-bugreport]
[–permission-target-system]
COUNT
adb shell pm list packages -3 找出三方安装的app 包

adb shell monkey 100 对所有包随机操作
adb shell monkey -p com.xueqiu.android 100 对指定包
时间延迟500毫秒 adb shell monkey -p com.xueqiu.android --throttle 500 100
日志分析 adb shell monkey -p com.xueqiu.android -vv 100
提升触摸事件百分比80 adb shell monkey -p com.xueqiu.android -vv --pct-touch 80 100
–pct-motion 动作时间,滑动(直线)
–pct-trackball 轨迹时间,移动+点击,曲线滑动
–pct-majornav 主要导航事件,比如回退按键,菜单按键

如果想让日志执行过程中不被报错中断,可以adb shell monkey -p com.xueqiu.android --ignore-security-exceptions --ignore-native-crashes --ignore-crashes --ignore-timeouts --monitor-native-crashes --throttle 1000 100

monkey命令日志设置
-v 除启动提示,测试完成和最终结果之外,提供较少信息
-v-v 提供较为详细的测试信息,如逐个发送到Activity的事件
-v-v-v 提供更加详细的设置信息,如测试中被选中的或未被选中的Activity

adb shell monkey -p com.xueqiu.android --ignore-security-exceptions --ignore-native-crashes --ignore-crashes --ignore-timeouts --monitor-native-crashes -v-v-v --throttle 1000 100
保存日志到本地adb shell monkey -p com.xueqiu.android --ignore-security-exceptions --ignore-native-crashes --ignore-crashes --ignore-timeouts --monitor-native-crashes -v-v-v --throttle 1000 100 >/Users/chenmiaomiao/xueqiu.log

Monkey: seed=1637156828096 count=100
如果执行过程中遇到bug需要复现
adb shell monkey -s 1637291120917 -p com.xueqiu.android -v-v-v >/Users/chenmiaomiao/xueqiu.log
验证adb shell monkey -s 100 -p com.xueqiu.android -v-v-v 50

提高事件百分比,提高触摸事件比例为10%,执行100次
adb shell monkey -p com.xueqiu.android ----pct-touch 10 100

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值