Monkey基本常用命令整理
2024-08-21 14:12:01
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=*
最新文章
- C#语言基础
- jQuery学习笔记(四)jQuery中的动画
- C语言学习1——结构体剖析
- 【情人节来一发】网站添加QQ客服功能
- Linux(CentOS、Ububtu)一键安装Openstack及其它参考文档汇总
- MySQL数据库在WINDOWS系统CMD下的编码问题
- PhpStorm中配置xdebug调试环境
- BestCoder Round #71 (div.2) (hdu 5620 菲波那切数列变形)
- android中常用的弹出提示框
- tar、zip 、unzip 打包与压缩 (参考:http://pengyl.blog.51cto.com/5591604/1191197)
- [转]OpenSolaris 2009.06, dev setup
- Matlab: 作图
- 后端对数组json_encode,前端遍历输出
- 【eclipse】eclipse报错:the resource is not on the build path of a java project
- 递归 - Leetcode 110 判断二叉树是否为平衡二叉树
- ES5-ES6-ES7_iterator和for of
- c++不定参数函数
- 解决 Sublime text3 中文显示乱码问题【亲测可用】
- 20. Valid Parentheses (Stack)
- lower_case_table_names
热门文章
- 【Anroid界面实现】WindowManager类使用具体解释——用户首次打开APP的使用教学蒙板效果实现
- ACdream 1112 Alice and Bob (博弈&;amp;&;amp;素数筛选优化)
- FZU 1894 志愿者选拔【单调队列】【monotone decreasing queue】
- DM8168 IPNC Boa移植
- write data to xml
- Android单选中listview中的一项
- thinkphp的session用法
- go之变量、指针、引用地址
- C - Tram
- windows phone媒体应用开发