monkey
来源:互联网 发布:使命召唤8武器数据 编辑:程序博客网 时间:2024/05/18 02:53
1.压力测试的目的:
提高产品的稳定性;提高产品的留存率;
2.压力测试时间:
首轮功能测试通过后下班后的夜间
3.自动化测试--随机事件的工具
4.Monkey在手机系统里--模拟随机事件
Monkey工具--adb 连接(Android Debug Bridge)
adb是调试手机上任何应用的入口
5.MonkeyScript -可以被Monkey识别的命令集合,可以完成重复固定的操作
辅助类
MonkeyRunner-可以截屏,模拟事件,提供api。
6.MonkeyRunner APIs
MonkeyRunner:用来连接设备或模拟器
MonkeyDevice:提供安装、卸载应用,发送模拟事件
MonkeyImage:完成图像保存,及对比的操作
7.测试结果
CRASH:崩溃--致命
ANR:application not responding
实践:
1.配置adb命令 + python(https://www.python.org/downloas/)
将python的安装目录添加到环境变量path里
2.adb devices
安装apk
3.adb shell 报名.apk
压力指令
4. adb shell monkey 1000
5.获取app报名
adb logcat|grep START(linux下命令)
adb logcat|findstr START(win7命令)--抓取包名
win:
adb shell pm list packages (列出所有的包名)
dumpsys package 包名
adb shell dumpsys package
6.指定包名打压力
adb shell monkey -p package 1000
指定事件之间的间隔:
adb shell monkey --throttle <milliseconds>
命令:adb shell monkey -p 包名 --throttle 时间 次数
例:adb shell monkey -p com.meizu.flyme.calculator --throttle 100 1000
7.seed 参数 -- monkey高级参数的应用(可复现重复操作步骤)
指定随机生成的seed值
adb shell monkey -p 包名 -s seed值 随机次数
例如:adb shell monkey -p 包名 -s 100 50
8.触摸事件
设置触摸事件的百分比 --序号0
adb shell monkey -p 包名 --pct-touch 百分比 一共执行的次数
例:adb shell monkey -p com.meizu.flyme.calculator --pct-touch 100 100
加 -v 可以看详情,具体执行比例
adb shell monkey -v -p 包名 --pct-touch 百分比 一共执行的总次数
例: adb shell monkey -v -p com.meizu.flyme.calculator --pct-touch 100 10
9. 动作事件
设定动作事件百分比 序号1
adb shell monkey --pct-motion<percent>
10.轨迹球事件
设定轨迹球事件百分比 序号3
adb shell monkey --pct-trackball<percent>
11.基本导航事件 --序号5
设定基本导航事件百分比,输入设备的上下左右
adb shell monkey --pct-nav<percent>
12. -majornav -软键盘 中间键 序号6
adb shell monkey --pct-major
13.home -syskeys 系统键,拨号键,音量键 序号7
adb shell monkey --pct-syskeys
14.切换activity -appswitch 序号8
adb shell monkey --pct-appswitch
15.其他事件 序号10
--anyevent
adb shell monkey --pct-anyevent
16.崩溃事件
忽略
adb shell monkey --ignore-crashes<event-count>
17.超时事件
ANR事件
adb shell monkey --ignore-timeouts<event-count>
CRASH结果析取
1. 安装有carsh的app
2. 执行压力测试
3.析取carsh的exception信息
命令如下: adb shell monkey -p 包名 --pct-touch 100 --ignore-crashes 1000
忽略异常--
ANR析取
命令同CARSH析取过程 traces.txt文件
adb shell monkey -p 包名 --pct-touch 100 --ignore-timeouts 1000
方法2:
在/data/anr 目录下的
Monkey Script--可完成固定的操作
执行Monkey脚本的命令:
adb shell monkey -f<scriptfile><event-count>
提高产品的稳定性;提高产品的留存率;
2.压力测试时间:
首轮功能测试通过后下班后的夜间
3.自动化测试--随机事件的工具
4.Monkey在手机系统里--模拟随机事件
Monkey工具--adb 连接(Android Debug Bridge)
adb是调试手机上任何应用的入口
5.MonkeyScript -可以被Monkey识别的命令集合,可以完成重复固定的操作
辅助类
MonkeyRunner-可以截屏,模拟事件,提供api。
6.MonkeyRunner APIs
MonkeyRunner:用来连接设备或模拟器
MonkeyDevice:提供安装、卸载应用,发送模拟事件
MonkeyImage:完成图像保存,及对比的操作
7.测试结果
CRASH:崩溃--致命
ANR:application not responding
实践:
1.配置adb命令 + python(https://www.python.org/downloas/)
将python的安装目录添加到环境变量path里
2.adb devices
安装apk
3.adb shell 报名.apk
压力指令
4. adb shell monkey 1000
5.获取app报名
adb logcat|grep START(linux下命令)
adb logcat|findstr START(win7命令)--抓取包名
win:
adb shell pm list packages (列出所有的包名)
dumpsys package 包名
adb shell dumpsys package
6.指定包名打压力
adb shell monkey -p package 1000
指定事件之间的间隔:
adb shell monkey --throttle <milliseconds>
命令:adb shell monkey -p 包名 --throttle 时间 次数
例:adb shell monkey -p com.meizu.flyme.calculator --throttle 100 1000
7.seed 参数 -- monkey高级参数的应用(可复现重复操作步骤)
指定随机生成的seed值
adb shell monkey -p 包名 -s seed值 随机次数
例如:adb shell monkey -p 包名 -s 100 50
8.触摸事件
设置触摸事件的百分比 --序号0
adb shell monkey -p 包名 --pct-touch 百分比 一共执行的次数
例:adb shell monkey -p com.meizu.flyme.calculator --pct-touch 100 100
加 -v 可以看详情,具体执行比例
adb shell monkey -v -p 包名 --pct-touch 百分比 一共执行的总次数
例: adb shell monkey -v -p com.meizu.flyme.calculator --pct-touch 100 10
9. 动作事件
设定动作事件百分比 序号1
adb shell monkey --pct-motion<percent>
10.轨迹球事件
设定轨迹球事件百分比 序号3
adb shell monkey --pct-trackball<percent>
11.基本导航事件 --序号5
设定基本导航事件百分比,输入设备的上下左右
adb shell monkey --pct-nav<percent>
12. -majornav -软键盘 中间键 序号6
adb shell monkey --pct-major
13.home -syskeys 系统键,拨号键,音量键 序号7
adb shell monkey --pct-syskeys
14.切换activity -appswitch 序号8
adb shell monkey --pct-appswitch
15.其他事件 序号10
--anyevent
adb shell monkey --pct-anyevent
16.崩溃事件
忽略
adb shell monkey --ignore-crashes<event-count>
17.超时事件
ANR事件
adb shell monkey --ignore-timeouts<event-count>
CRASH结果析取
1. 安装有carsh的app
2. 执行压力测试
3.析取carsh的exception信息
命令如下: adb shell monkey -p 包名 --pct-touch 100 --ignore-crashes 1000
忽略异常--
ANR析取
命令同CARSH析取过程 traces.txt文件
adb shell monkey -p 包名 --pct-touch 100 --ignore-timeouts 1000
方法2:
在/data/anr 目录下的
Monkey Script--可完成固定的操作
执行Monkey脚本的命令:
adb shell monkey -f<scriptfile><event-count>
1 0
- monkey
- monkey
- monkey
- Monkey
- Monkey
- monkey
- monkey
- monkey
- Monkey
- Monkey
- Monkey
- Monkey
- monkey
- Monkey
- monkey
- monkey
- monkey
- monkey
- 正则表达式匹配非空非中文
- LeetCode101. Symmetric Tree
- 文件导入
- LeetCode104. Maximum Depth of Binary Tree
- $.get、$.post、$getJSON、$ajax的用法跟区别
- monkey
- LeetCode110. Balanced Binary Tree
- [Android设计模式]Android退出应用程序终极方法
- 移动地图出黑线白线的解决方案
- 在jquery ui dialog里面的autocomplete和chosen插件的下拉列表被覆盖的解决方法
- 程序员的机器学习入门笔记(七):推荐系统入门介绍
- iOS开发 ☞ key window
- LeetCode235. Lowest Common Ancestor of a Binary Search Tree
- 手机自适应网页设计(html5/css3控制)