Monkey基本常用命令整理

adb shell monkey   -v 500  >F:/monkeylog2018.txt    -P表示包名   -V表示输出日志的详细级别  一个-V表示一级 递增  >输出日志的目录
 
adb shell monkey -p com.htc.Weather –s 10 100       -s 10 前后两条命令相同,那么其随机的内容也是相同的,这样可以在对比测试的时候用到
 
adb shell monkey -p com.huawei.Weather –throttle 3000 100    每次操作都延迟3秒 随机事件100次 这样可以给app留有响应时间,连网时间,加载时间
 
--ignore-crashes adb shell monkey -p com.huawei.Weather --ignore-crashes 1000   忽略事件  可以忽略崩溃测试过程中即使程序崩溃,Monkey依然会继续发送事件直到事件数目达到1000为止
 
--ignore-timeouts     adb shell monkey -p com.huawei.Weather --ignore-timeouts 1000 忽略超时  如果程序发生anr超时错误  仍然继续运行
 
--ignore-security-exceptions   adb shell monkey -p com.huawei.Weather --ignore-security-exceptions 1000       即使应用程序发生许可错误,Monkey依然会发送事件,直到事件计数完成
 
--kill-process-after-error   发生错误后直接杀掉进程:用于指定当应用程序发生错误时,是否停止其运行。如果指定此参数,当应用程序发生错误时,应用程序停止运行并保持在当前状态(注意:应用程序仅是静止在发生错误时的状态,系统并不会结束该应用程序的进程
 
--monitor-native-crashes adb shell monkey -p com.huawei.Weather --kill-process-after-error  --monitor-native-crashes 1000 跟踪本地方法崩溃问题:用于指定是否监视并报告应用程序发生崩溃的本地代码,
 
指定事件百分比:
用于指定每种类别事件的数目百分比(在Monkey事件序列中,该类事件数目占总事件数目的百分比),虽然事件是随机的,但是你可以指定其中某种动作的比例,根据app的特点而进行设置,某些app滑动多,某些app点击多,这样可以更贴近app应用场景的设置随机事件进行测试
 
--pct-{+事件类别} {+事件类别百分比}:
 
--pct-touch {+百分比}:触摸事件:adb shell monkey -p com.huawei.Weather --pct-touch 10 1000
 
--pct-motion {+百分比}:动作事件:adb shell monkey -p com.huawei.Weather --pct-motion10 1000
 
--pct-trackball {+百分比}:轨迹事件:adb shell monkey -p com.huawei.Weather --pct-trackball 10 1000
 
--pct-nav {+百分比}:基本导航:adb shell monkey -p com.huawei.Weather --pct-nav 10 1000
 
--pct-majornav {+百分比}:主要导航:adb shell monkey -p com.huawei.Weather --pct-majornav 10 1000
 
--pct-syskeys {+百分比}:系统按键:adb shell monkey -p com.huawei.Weather --pct-syskeys 10 1000
 
--pct-appswitch {+百分比}:启动activity(日志里见过这个switch吧):adb shell monkey -p com.huawei.Weather --pct-appswitch  10 1000
 
--pct-anyevent {+百分比}:其他事件:
 
指定单个类型事件的百分比:
 
adb shell monkey -p com.huawei.Weather --pct -anyevent 20  1000
 
指定多个类型事件的百分比:
 
adb shell monkey -p com.huawei.Weather --pct-anyevent 30  --pct-appswitch 30   1000
 
注意:各事件类型的百分比总数不能超过100%
 
防止monkey点击状态栏
adb shell settings put global policy_control immersive.full=*

转载于:https://www.cnblogs.com/ssyimeng/p/9777661.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值