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