猴子跑步时更改屏幕方向 [英] Change screen orientations during monkey run

查看:101
本文介绍了猴子跑步时更改屏幕方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Monkey命令对我的应用程序进行一些压力测试.但是我想针对屏幕方向进行更多测试,以在更改方向时检测并捕获一些堆更新.我在整个android官方网站上搜索了有关猴子命令/参数的信息,这些命令/参数将在任何应用程序/活动上运行时进行屏幕定向.但是没有运气,也没有想过要像您这样的专业人士.

I'm using monkey command to do some stress testing on my app. But i want to test it more with respect to screen orientations to detect and capture some heapupdates while changing orientations. I searched all over android official site about monkey commands/arguments which will do screen orientations while running on any app/activity. But no luck and thought of asking professionals like you.

如果对此有任何想法,请告诉我.

If idea on this, please let me know.

推荐答案

猴子有许多未公开说明的选项,包括--pct-rotation.将该开关添加到您的命令中,并观看屏幕旋转,就像恶魔所拥有的一样:

Monkey has a number of undocumented options, including --pct-rotation. Add that switch to your command and watch your screen rotate like it's possessed by demons:

最高(包括)adb版本1.0.31:

Up to (including) adb version 1.0.31:

adb shell monkey -p com.example.app -v --pct-rotation=70 500

从adb 1.0.32版开始:

Since adb version 1.0.32:

adb shell monkey -p com.example.app -v --pct-rotation 70 500

查看monkey命令的 processOptions()方法以查看所有受支持的选项:

Look in the processOptions() method of the monkey command to see all of the supported options: https://android.googlesource.com/platform/development.git/+/master/cmds/monkey/src/com/android/commands/monkey/Monkey.java

查看 MonkeySourceRandom 类的构造函数,以查看所有事件类型的默认百分比.这些是发布本文时master分支中的当前值.请注意,旋转的默认值为0:

Look at the constructor for the MonkeySourceRandom class to see the default percentages for all of the event types. These are the current values in the master branch at the time of this post. Note that the default for rotation is 0:

    // default values for random distributions
    // note, these are straight percentages, to match user input (cmd line args)
    // but they will be converted to 0..1 values before the main loop runs.
    mFactors[FACTOR_TOUCH] = 15.0f;
    mFactors[FACTOR_MOTION] = 10.0f;
    mFactors[FACTOR_TRACKBALL] = 15.0f;
    // Adjust the values if we want to enable rotation by default.
    mFactors[FACTOR_ROTATION] = 0.0f;
    mFactors[FACTOR_NAV] = 25.0f;
    mFactors[FACTOR_MAJORNAV] = 15.0f;
    mFactors[FACTOR_SYSOPS] = 2.0f;
    mFactors[FACTOR_APPSWITCH] = 2.0f;
    mFactors[FACTOR_FLIP] = 1.0f;
    mFactors[FACTOR_ANYTHING] = 13.0f;
    mFactors[FACTOR_PINCHZOOM] = 2.0f;

查看全文

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