I downloaded Robolectric deckard-gradle project from https://github.com/robolectric/deckard-gradle and imported to Android Studio.
On my first run i got
!!! JUnit version 3.8 or later expected:
java.lang.RuntimeException: Stub!
at junit.runner.BaseTestRunner.<init>(BaseTestRunner.java:5)
at junit.textui.TestRunner.<init>(TestRunner.java:54)
at junit.textui.TestRunner.<init>(TestRunner.java:48)
at junit.textui.TestRunner.<init>(TestRunner.java:41)
Error and i fixed this from .iml.
Then i got:
Class Not Found "my test class"
I tried dozens of solutions which i found in google about this problem but none of them worked.
iml
file:<output-test url="file://$MODULE_DIR$/build/test-classes" />
. It should go under the<output url=....
element in the iml file. Also make sure that the path for yourtest-output
corresponds to the path where the actual classes are created. Not to mention that you need to add atest
gradle task to your AS so that your tests are compiled. See this link for more info and you should be good to go. Hope that helps! – Getupandgo