A Gradle plugin that allows for the execution of JUnit 5 unit tests in Android environments.
buildscript {
dependencies {
classpath "de.mannodermaus.gradle.plugins:android-junit5:1.0.0-M6"
}
}
Snapshots of the development version are available through Sonatype's snapshots
repository.
apply plugin: "com.android.application"
apply plugin: "de.mannodermaus.android-junit5"
dependencies {
testApi junitJupiter()
// (Optional) If you need "parameterized tests"
testApi junitParams()
}
This plugin configures the junitPlatform
task for each registered build variant of a project.
It automatically attaches both the Jupiter & Vintage Engines during the execution phase of your tests.
More instructions on how to write JUnit 5 tests can be found in their User Guide. Furthermore, this repository provides a small showcase of the functionality provided by JUnit 5 here.
Inside the configuration closure applied by the plugin, you can specify the same properties as you would for a Java-based project with the JUnit Platform Gradle plugin. However, there are some additional properties that you can apply:
junitPlatform {
// The JUnit Jupiter dependency version to use; matches the platform's milestone by default
jupiterVersion "5.0.0-M6"
// The JUnit Vintage Engine dependency version to use; matches the platform's milestone by default
vintageVersion "4.12.0-M6"
}