Over the Christmas holidays Google has integrated the Espresso testing framework into its android built tools and bumped the version to 2.0. Old espresso maven repos went dead because of that which forced us to temporally move to Jake Wharton’s repo until we got the time to move. I was the fortunate one who had to make the switch. This post describes the pitfalls of the upgrade.
Pure espresso upgrade is described here:
https://code.google.com/p/android-test-kit/wiki/EspressoSetupInstructions
And we found a great article:
http://engineering.circle.com/instrumentation-testing-with-dagger-mockito-and-espresso/
which describes how to use the new Espresso 2.0 along with the new Dagger dependency injection framework. Really nice stuff and it is worth reading and seeing the code samples on github. It inspired me to try out the new Dagger 2.0 (http://google.github.io/dagger/) along with Espresso.
I encountered following pitfalls when modifying our app:
StackOverflowException during compilation
NullPointerException during compilation
No provider can throw exception during initialization
java.lang.NoClassDefFoundError: com/app/data/DebugDataModule$$ProvideFactory
[code lang=”groovy”]
androidTestCompile (‘com.android.support.test.espresso:espresso-core:2.0’) {
exclude group: ‘javax.inject’
}
[/code]