使用 Monkey Test 时如何防止进入设置 [英] How to prevent entering settings when using Monkey Test

查看:56
本文介绍了使用 Monkey Test 时如何防止进入设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 android 设备 (LG G4) 上对我的应用程序进行了猴子测试.

I have a monkey test with my application in android device(LG G4).

命令是

adb shell monkey -p {包名} -v 2000

但它可能会意外进入设置并更改我设备的默认值.

But it may accidentally enter settings and change my device's default value.

如何预防?

推荐答案

Monkey 支持黑名单,你可以在黑名单中设置包名然后运行 ​​Monkey,Monkey 不会在你设置在黑名单中的包中执行测试.

Monkey support blacklist, you could your setting package name in blacklist then run Monkey, Monkey will not perform test in package which you set in blacklist.

你可以这样做:

  1. adb shell pm list packages 获取你设置的包名
  2. 打开一个 blacklist.txt 文件,并在其中输入包名,然后将其推送到您的设备,如/sdcard/blacklist.txt
  3. 像这样使用 --pkg-blacklist-file 运行 Monkey:adb shell monkey --pkg-blacklist-file/sdcard/blacklist.txt
  1. adb shell pm list packages get your setting package name
  2. open a blacklist.txt file, and put package name in it, then push it to your device like /sdcard/blacklist.txt
  3. run Monkey with --pkg-blacklist-file like this: adb shell monkey --pkg-blacklist-file /sdcard/blacklist.txt

这篇关于使用 Monkey Test 时如何防止进入设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆