Gradle Plugin: 1.0.31
This release enhances the compatibility for instrumentation tests with JUnit 5, improves internally by raising the minimum required Gradle version, and removes some deprecated APIs. It also updates the android-instrumentation-test
library dependency to 0.2.1
. If you explicitly depend on an earlier version in your build.gradle
, please update.
Instrumentation Tests
Instrumentation Test Support is now transparently enabled by default, however you won't notice the impact of its minSdkVersion 26
requirement if you don't want to. At most, you will see an innocuous statement in your Logcat, but that's it:
E/TestLoader: Could not find class: de.mannodermaus.junit5.AndroidJUnit5
This refers to JUnit 5 detection being silently turned off if it doesn't detect the required runtime dependencies, which you provide through the junit5.instrumentationTests()
dependency handler. If you do provide JUnit 5 tests though, they will be picked up by the Android Test Runner, and included in the resulting reports.
Creating a product flavor for experiments with JUnit 5 instrumentation tests is a great way of getting to know the new APIs in a safe way. Consult the sample application's build.gradle
for how this can be done.
Minimum Gradle Version
Previously, the android-junit5 plugin mirrored its big brother's minimum Gradle requirement, which was 2.5+
. With this release, this requirement was upgraded to 4.3+
. This helps with internal house-keeping, as well as migration to new APIs exposed by Gradle.
With first-party support for JUnit 5 in recent versions of Gradle, expect this minimum requirement to go up even further in the future. Consult the README for a new section on minimum required Gradle versions.
API Changes
- New:
junitPlatform.unitTests.all
can be used to configure JUnit test tasks (JVM arguments, environment variables, system properties) - New:
junitPlatform.jacocoOptions.taskGenerationEnabled
can be used to turn off automatic generation of Jacoco companion tasks if the plugin is applied alongside android-junit5 - New:
junitPlatform.jacocoOptions.onlyGenerateTasksForVariants
can be used to specify Build Variants that should be provided with Jacoco companion tasks; all other variants won't get one. By default, this is an empty list, which will cause all variants to factor into task generation - Removed: The top-level
junitPlatform
closure is now gone. Move your configuration intoandroid.TestOptions.junitPlatform
! - Removed: The
junitPlatform.jacoco
container had been renamed tojacocoOptions
; with this release, the old container is now gone.