How to prevent entering settings when using Monkey Test

一个人想着一个人 提交于 2019-12-13 14:22:36

问题


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

The command is

adb shell monkey -p {package name} -v 2000

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

How to prevent it ?


回答1:


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.

you can do like this:

  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



回答2:


You can use screen pinning. Start the app/package you want to test. Pin it. Then start monkey with e.g. adb shell monkey -p {package name} -v 2000. This worked for me on an Android device running Nougat (7.0).



来源:https://stackoverflow.com/questions/34059538/how-to-prevent-entering-settings-when-using-monkey-test

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!