Issue
I'm currently trying to add Espresso tests into a release APK. In our case we have to test on what's actually being released so the UI tests have to be included in the release.
So my primary question is: How is this best accomplished? Research on the internet gave me no result so far.
I already tried changing androidDebugTest
in the build script to compile
:
compile 'com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
}
And also here:
compile 'com.android.support.test.espresso:espresso-contrib:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'design'
exclude group: 'com.android.support', module: 'recyclerview-v7'
}
But after calling
./gradlew assembleRelease --info --debug
I get this error message:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithJarMergingForRelease'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: javax/annotation/Generated.class
...
BUILD FAILED
Furthermore usually there are two gradle tasks assembleDebug
and assembleDebugAndroidTest
to work with Espresso. But what are doing with a release build as there is no assembleReleaseAndroidTest
task?
Thanks for you advice in advance!
Solution
You can't compile the tests into the app APK, but you can test against the release build type. In your case your release artifacts would consist of two APKs, the regular app APK and the test APK. See https://stackoverflow.com/a/18064368/1231827.
Answered By - Kevin Brotcke
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.