3

I've written some unit tests in my Android projects with Robolectric, and some of them even don't use Android.

I've tried first this: robolectric-gradle-plugin, following this template. The result is that I've faced this bug in IDEA, that I reported myself.

Then I've tried another possibility: the gradle-android-test-plugin, which separates tests in another submodule, that is a regular Java project. I've tried to follow this other template. I've open this bug report.

Then I've faced again with other bug.

What recommendations can you provide me, that does work?

david.perez
  • 6,090
  • 4
  • 34
  • 57

1 Answers1

0

Finally I've had to upgrade IDEA to 14 EAP, and know it works ok.

gradle-android-test-plugin seems to work better than robolectric plugin, as I can run JUnit and ScalaTest tests easily. I've had to install with a script, the non-published com.novoda:gradle-android-test-plugin:0.9.9-SNAPSHOT.

It's a hell the combination of versions of:

  • Android Build Tools
  • Gradle
  • com.android.tools.build:gradle
  • IDEA
  • robolectric
  • robolectric plugin
  • ....

Any change in one of them, can make your project fail.

Luckily, by using Gradle you can fix the versions of every component, and do Continous integration.

david.perez
  • 6,090
  • 4
  • 34
  • 57