I’m in the middle of migrating a project from Intellij IDEA 12 to Android Studio, and we’re trying to set up the Gradle build files to also let us build our project on a continuous integration server. I’m having a lot of trouble migrating the unit tests though.
My unit tests use Robolectric. I’m using the gradle-android-test-plugin to get Robolectric working. My unit tests are under src/test/java, next to the main source files in src/main/java. I have four subprojects included in the root’s settings.gradle and an empty root build.gradle.
The unit tests only run for one of my subprojects when I execute “gradle test”. For all of the other subprojects, the test classes are built and I see them under build/test-classes, but none of the tests are executed.
What could I be missing? I’m totally new to Gradle (and other Java build automation tools), so please let me know if I should be posting any more information about my configuration. Thanks!
I’m using the (default?) “test” task. I’m not sure whether this is built-in to Gradle, or comes from the “android”, “android-library”, or “android-test” plugin. Where should I look to find out more information for you?
I have my test classes under the $SUBPROJECT/src/test/java directory, and they’re configured with JUnit 4’s annotations.
I have the same build.gradle file for both the subproject with working tests and the subproject that doesn’t run any tests: