freepascal / android-test-kit

Automatically exported from code.google.com/p/android-test-kit
0 stars 0 forks source link

Espresso fails when app uses Dagger 2.0 #105

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use dagger 2.0 in an app
2. `./gradlew connectedCheck`

What is the expected output? What do you see instead?
I expect tests to run.  Instead, the test run fails hard while attempting to 
link classes.

Example logcat (when excluding dagger from espresso):
I/TestRunner( 7610): ----- begin exception -----
I/TestRunner( 7610): 
I/TestRunner( 7610): java.lang.NoClassDefFoundError: dagger.ObjectGraph
I/TestRunner( 7610):    at 
com.google.android.apps.common.testing.ui.espresso.GraphHolder.graph(GraphHolder
.java:32)
I/TestRunner( 7610):    at 
com.google.android.apps.common.testing.ui.espresso.Espresso.espressoGraph(Espres
so.java:36)
I/TestRunner( 7610):    at 
com.google.android.apps.common.testing.ui.espresso.Espresso.onView(Espresso.java
:51)
I/TestRunner( 7610):    at 
com.kii.safe.test.SomeTestClass.testThatThing(SomeTestClass.java:84)
I/TestRunner( 7610):    at java.lang.reflect.Method.invokeNative(Native Method)
I/TestRunner( 7610):    at java.lang.reflect.Method.invoke(Method.java:511)
I/TestRunner( 7610):    at 
android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
I/TestRunner( 7610):    at 
android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
I/TestRunner( 7610):    at 
android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTes
tCase2.java:192)
I/TestRunner( 7610):    at junit.framework.TestCase.runBare(TestCase.java:134)
I/TestRunner( 7610):    at 
junit.framework.TestResult$1.protect(TestResult.java:115)
I/TestRunner( 7610):    at 
junit.framework.TestResult.runProtected(TestResult.java:133)
I/TestRunner( 7610):    at junit.framework.TestResult.run(TestResult.java:118)
I/TestRunner( 7610):    at junit.framework.TestCase.run(TestCase.java:124)
I/TestRunner( 7610):    at 
android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190)
I/TestRunner( 7610):    at 
android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175)
I/TestRunner( 7610):    at 
android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:55
5)
I/TestRunner( 7610):    at 
com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunne
r.onStart(GoogleInstrumentationTestRunner.java:167)
I/TestRunner( 7610):    at 
android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1661)
I/TestRunner( 7610): ----- end exception -----

What version of the product are you using? On what operating system?
I'm using double-espresso 1.1-r3, though this problem applies equally to the 
latest version in this repository.  OS X Yosemite.

Please provide any additional information below.
Ultimately this bug stems from 
https://code.google.com/p/android/issues/detail?id=65445.  Apps that use a 
version of Dagger compatible with Espresso's can simply exclude the latter's 
version and things will work.  Unfortunately, Dagger v2 does not contain 
ObjectGraph at all, so this trick won't work.

Until #65445 is fixed, Espresso should shade its dependencies, or at least its 
own copy of Dagger.

Original issue reported on code.google.com by b...@getkeepsafe.com on 27 Nov 2014 at 9:49

GoogleCodeExporter commented 9 years ago
New release coming soon and will move the Dagger dep out of the way.

Original comment by vale...@google.com on 11 Dec 2014 at 9:51

GoogleCodeExporter commented 9 years ago
Awesome! Do you have a rough ETA? I had to switch to Robotium for now, but 
would love to switch back to Espresso.

Original comment by stern....@gmail.com on 11 Dec 2014 at 9:53

GoogleCodeExporter commented 9 years ago
Fixed in Espresso 2.0

Original comment by vale...@google.com on 20 Dec 2014 at 4:33

GoogleCodeExporter commented 9 years ago
Fantastic, thanks for the great release!

Original comment by b...@getkeepsafe.com on 21 Dec 2014 at 9:09