Android Studio Unit Test

Compatible with: IntelliJ IDEA Android Studio
Dec 06, 2014
23 027
Android Studio IDE support for Android gradle unit tests. Prepared for Robolectric.
This plugin will mark test directories and resolve testCompile dependencies. It also sets up the correct system properties for Robolectric.

Download plugin

Recent change notes

  • Modify JUnit run configuration on Android Studio to run a gradle task to build the test sources. This should remove the need to of any workarounds. For best results, you should delete and recreate any JUnit run configurations for your project.
  • Made variant selection a bit more robust
  • Don't require a gradle refresh when reopening a project.
  • Fixed compatibility with the latest versions of Android Studio.
  • Dropped support for old versions of the android-unit-test plugin that used a custom model to pass data. Requires version 1.5.+.
  • Fixed classpath being incorrectly set for the junit test runner.
  • Support attaching javadoc and sources downloaded by android-unit-test (requires version 1.6.+).
  • Fixed bug where multiple modules with the unit test plugin applied would cause the junit test runner to pass in the wrong module's parameters.
  • Support using the android model to pass data from the gradle plugin. In the future, the will be the only way support, so make sure you update your android-unit-test plugin!
  • Correctly mark test resources directories. Note: test resources are still not found when run from the IDE.