(三)测试工具-5 事件类参数

事件类参数

1、扫行指定脚本
$ adb shell monkey -f
adb shell monkey -f /mnt/sdcard/test1

2、伪随机数生成种子植
伪随机数生成器的seed值。如果用相同的seed值再次运行monkey,将生成相同的事件序列。
adb shell monkey -p com.bocom.xxhz -s 88 50
【解释】
-s <seed值>
(三)测试工具-5 事件类参数

执行事件百分比

adb shell monkey -v -p com.bocom.xxhz 100 50
【解释】
-v:列出详细的进度百分比
100:执行百分比
50:随机事件数
(三)测试工具-5 事件类参数

事件标号 解释
0–pct-touch 触摸事件(屏幕按下、弹起的操作),点击时间百分比
1–pct–motion事件 手势事件(直线滑动操作)
2–pct–pinchzoom事件 二指缩放事件
3–pct–trackball 事件 轨迹球事件(包含曲线滑动操作)有点下拉刷新新闻列表
4–pct-rotation事件 屏幕旋转,degree表示的是旋转方向,顺时针旋转,0:90度,1:180度,2:270度,3:360度
5–permission事件
6–pct-nav基本导航事件 设备的上 下 左 右四个方向的导航
7–pct-majornav主要导航事件 app的中间键,返回键,菜单按键
8–pct-syskeys系统导航事件 硬件设备的Home键,返回键和拨号键和音量键
9–pct-appswitch参切换Activity事件 app里有多个Activity,我们切换到不同Activity
10–pct-flip事件 键盘轻弹,点击文本框,键盘弹起
11–其他事件

只做某几种事件,那么几种事件百分比相加一定要等于100%

3、设置间隔
monkey的事件执行的很快,加上throttle参数就可以控制每个事件
之间的间隔数
$ adb shell monkey --throttle
eg:
adb shell monkey -p com.bocom.xxhz --throttle 1000 100
【解释】
1000 --指间隔时间
100–指执行的实践数

(三)测试工具-5 事件类参数
4、调整触摸事件百分比
$ adb shell monkey --pct-touch
eg:
$ adb shell monkey -v -v --pct-touch 100 200
5、调整手势事件百分比
$ adb shell monkey --pct-motion
eg:
$ adb shell monkey -v -v --pct-motion 100 200
6、调整应用启动事件的百分比
$ adb shell monkey --pct-appswtich
应用启动事件(即activity launches)俗称打开应用,通过调用startActivity()方法最大限度地开启该package下的所有应用。
7、调整屏幕旋转事件百分比
$ adb shell monkey --pct-rotation
–pct-rotation 后面接屏幕旋转事件的比例值。