只有在一个子活动使用猴(Android的调试) [英] Using Monkey in a subactivity only (android debugging)

查看:193
本文介绍了只有在一个子活动使用猴(Android的调试)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用猴子debuggin工具(亚行)进行压力测试我的应用程序的部分。 由于猴子在总共随机的方式行事,我想它专注于code中的一部分可能包含我在寻找一个错误(非常罕见的错误,我不知道如何复制它)

I'm trying to use Monkey debuggin tool (from adb) to stress test a part of my application. As Monkey acts in a total random way, I'd like it to concentrate on the part of code that might contain an error I'm looking for (very rare bug, and I don't know how to replicate it).

所以,在我的主要活动我有6个按钮,每个按钮触发了一个新的活动。我想设置的猴子看起来只有在这些活动之一,每一项活动,从它入店。我找不到一个合理的方式来做到这一点。

So, in my Main activity I have 6 buttons, each fires up a new activity. I'd like to set monkey to look only in one of those activities, and every activity accesible from it. I cannot find a reasonable way to do it.

我已经试过
亚行外壳猴子-p my.package.name -c android.intent.category.MONKEY 1000
在我的清单文件我已经把一些活动,我很感兴趣:

I've tried the
adb shell monkey -p my.package.name -c android.intent.category.MONKEY 1000
and in my manifest file I've put in some activities, that I'm interested in:

        <intent-filter>
            <category android:name="android.intent.category.MONKEY"/>                
        </intent-filter>

但没有奏效。猴子仍然会调用不是由这个标签分类活动。 这是至关重要的猴子在选定的子活动的工作,因为它浪费时间约95%是通过我的应用程序漫游,子活动,我真的想测试之外。

But it didn't work. Monkey still fires up activities that are not categorized by this tag. It is crucial for Monkey to work in selected subactivities, because it wastes about 95% of time roaming through my app, outside of subactivities that I actually want to test.

另外,我已经尝试了一些简单的脚本,以启动所需的子活动,但没有成功。

Also I've tried some simple script to launch the desired subactivity, but with no success.

寻找任何帮助,
欢呼声,
kajman

Looking for any help,
cheers,
kajman

推荐答案

我也有一点问题,制约了猴子类别。我觉得它的目的不是为你承担的工作。它是如何工作的呢?我还没有明确的想法,只是用它进行试验。该文档是相当差的。

I have also had a bit of problems with constraining the monkey with categories. I think it is not intended to work as you assume. How it works then? I have no clear idea, just experimenting with it. The documentation is quite poor.

有关你的问题,你可以考虑以下方法

For your problem you could consider the following approaches

  1. 将你的子活动,在一个分装,并允许访问只分装使用-p选项
  2. 添加一些约束到code表示prevents在应用程序中导航。例如设置onClickListeners什么都不做或禁用后退按钮被测活动时遇到了一些具体的条件。

P.S。您可以使用<一个href="http://www.netmite.com/android/mydroid/development/pdk/docs/instrumentation_framework.html#androidInstrumentationFrameworkamCommand"相对=nofollow>亚行外壳上午开始,以启动所需的子活动。再差的文件,没有例子,但动作是你里面的意图过滤器中定义为您的Andr​​oidManifest活动的操作的名称。 Name是活动的名称,例如

P.S. You can use adb shell am start in order to start the desired subactivity. Again poor documentation, no example, but the action is the name of the action you have defined inside intent-filter for the activity in your AndroidManifest. Name is the Activity name, for example

adb shell am start -a my.package.app.ACTION1 -n my.package.app/.sub.MyActivity

这篇关于只有在一个子活动使用猴(Android的调试)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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