我正在使用eclispe处理uiautomator 1.0.1并生成jar文件并在我的设置中使用。 任何人都可以指向适当的来源,我可以逐步程序切换到使用Android Studio的Uiautomator 2.0。
答案 0 :(得分:0)
要在Gradle项目中使用Android测试支持库,请在build.gradle文件中添加这些依赖项:
dependencies {
androidTestCompile 'com.android.support.test:runner:0.4'
// Set this dependency to use JUnit 4 rules
androidTestCompile 'com.android.support.test:rules:0.4'
// Set this dependency to build and run Espresso tests
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
// Set this dependency to build and run UI Automator tests
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
}
此外,您需要将JUnitRunner设置为Gradle项目中的默认测试工具运行器(UI Automator 2.0使用 android.support.test.runner.AndroidJUnitRunner 而不是 android.test。 InstrumentationTestRunner 强>)。
android {
defaultConfig {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}
有关详情,请点击here链接。