包之后,Monkey将只允许系统启动指定的APP。如果不指定包,Monkey将允许系统启动设备中的所有APP。
* 指定一个包: adb shell monkey -p com.htc.Weather 100
说明:com.htc.Weather为包名,100是事件计数(即让Monkey程序模拟100次随机用户事件)。
* 指定多个包:adb shell monkey -p com.htc.Weather –p com.htc.pdfreader -p com.htc.photo.widgets 100
* 不指定包:adb shell monkey 100
说明:Monkey随机启动APP并发送100个随机事件。
* 要查看设备中所有的包,在CMD窗口中执行以下命令:
adb shell
#cddata/data
#ls
- 参数: -v
用于指定反馈信息级别(信息级别就是日志的详细程度),总共分3个级别,分别对应的参数如下表所示:
日志级别 Level0
示例 adb shellmonkey -p com.htc.Weather –v 100
说明 缺省值,仅提供启动提示、测试完成和最终结果等少量信息
日志级别 Level 1
示例 adb shellmonkey -p com.htc.Weather –v -v 100
说明 提供较为详细的日志,包括每个发送到Activity的事件信息
日志级别 Level 2
示例 adb shellmonkey -p com.htc.Weather –v