约束类参数
1.包约束
-p:后面接一个或多个包名(),如果应用需要访问其他包里的Activity,那相关的包也需要在此同时指定。如果不指定任何包,monkey将允许系统启动全部包里的Activity。
$ adb shell monkey -p
eg:
$ adb shell monkey -p com.tal.kaoyan 500
$ adb shell monkey -p com.tal.kaoyan -p com.tencent.mm 500
2.activity类约束
如果你希望将monkey限制在一个或几个类别中,使用如下命令:
adb shell monkey -c
以下命令表示运行Intent.CATEGORY_LAUNCHER类别的Activity并发送1000个随机事件。
$ adb shell monkey -c Intent.CATEGORY_LAUNCHER 1000