I\'m trying to use Espresso. But I got this error and I have no if I\'m missing some codes.
any thoughts will be highly appreciated.
error log:
To clarify the instructions on https://code.google.com/p/android-test-kit/wiki/Espresso#Espresso_Setup_Instructions, referenced by @ValeraZakharov
When using Android Studio and gradle, there is no need to update AndroidManifest.xml, instead the file build.gradle
needs to be edited. Add this entry to the section android
- defaultConfig
:
android {
defaultConfig {
testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
}
}
Also: Right-click "add as a library" has been removed from Android studio, and replaced with:
android {
sourceSets {
// Espresso instrumentation tests
androidTest.setRoot('src/instrumentTest')
}
}
The complete section android
looks like this in my project:
android {
compileSdkVersion 17
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 15
targetSdkVersion 16
versionName getCommitNumber()
testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
}
sourceSets {
// Espresso instrumentation tests
androidTest.setRoot('src/instrumentTest')
}
packagingOptions {
// Multiple LICENSE.txt in hamcrest packages.
exclude 'LICENSE.txt'
}
}