Working With Uiautomator 2.0 And Android Studio 2.x
I was working with uiautomator 1.0.1 using eclispe and generating jar files and using in my setup. Can anyone point to appropriate source where I can get step by step procedure for
Solution 1:
To use the Android Testing Support Library in your Gradle project, add these dependencies in your build.gradle file:
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'
}
Also you need to set the JUnitRunner as the default test instrumentation runner in your Gradle project (UI Automator 2.0 uses android.support.test.runner.AndroidJUnitRunner instead of android.test.InstrumentationTestRunner).
android {
defaultConfig {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}
For more details, follow the link here.
Post a Comment for "Working With Uiautomator 2.0 And Android Studio 2.x"