vendredi 27 février 2015

Method setUp in android.test.AndroidTestCase not mocked

I'm trying to come with terms with the new unit test feature of Android Studio. I've followed the instructions on http://ift.tt/1KkPIk8. The description there explicitly mentions the 'Method ... not mocked' error and suggests to put the following into the build.gradle:



android {
// ...
testOptions {
unitTests.returnDefaultValues = true
}
}


This works in so far as the tests run when started from the command line with



gradlew test --continue


but not when I run the test class from Android Studio with rightclick -> run. This way, I get the same error again:



java.lang.RuntimeException: Method setUp in android.test.AndroidTestCase not mocked. See http://ift.tt/1zlzRtn for details.
at android.test.AndroidTestCase.setUp(AndroidTestCase.java)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)


Any ideas on how to solve this?


Aucun commentaire:

Enregistrer un commentaire