xiaojiangren 2016-04-21 02:30 采纳率: 27%
浏览 3139

关于android的UiAutomation

在初始化UiAutomation的时候返回了一个null值 看API是通过Instrumentation.getUiAutomation()来获取UiAutomation的实例的啊

public UiAutomation getUiAutomation() {
if (mUiAutomationConnection != null) {
if (mUiAutomation == null) {
mUiAutomation = new UiAutomation(getTargetContext().getMainLooper(),
mUiAutomationConnection);
mUiAutomation.connect();
}
return mUiAutomation;
}
return null;
}
这是API中的其中 一段返回null应该是mUiAutomationConnection==null

    mUiAutomationConnection实在
     /*package*/ final void init(ActivityThread thread,
        Context instrContext, Context appContext, ComponentName component, 
        IInstrumentationWatcher watcher, IUiAutomationConnection uiAutomationConnection) {
    mThread = thread;
    mMessageQueue = mThread.getLooper().myQueue();
    mInstrContext = instrContext;
    mAppContext = appContext;
    mComponent = component;
    mWatcher = watcher;
    mUiAutomationConnection = uiAutomationConnection;
}
    里面被赋值的到这里就不太明白了 这是怎么回事啊 有没有大神给解释下啊
  • 写回答

2条回答

  • Robot-C 2016-04-21 02:45
    关注

    转至:

    Android UI自动化测试这块一直是google忽略或者技术薄弱的地方,以至于他没有提供一套完整的自动化测试框架。国内公司做UI自动化测试一般都借助于第三方测试框架如robotium,淘宝测试(TMTS),Robolectric等。但这些测试框架或多或少都存在一些跨应用,事件等待等不足,无法满足UI自动化的所有要求。
      Android4.0之后,google仿照微软UIAut......
    答案就在这里:android UiAutomation
    ----------------------你好,人类,我是来自CSDN星球的问答机器人小C,以上是依据我对问题的理解给出的答案,如果解决了你的问题,望采纳。

    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?