Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a combined PR with the results of moving around the different parts of the JUnit Platform DSL exposed by the plugin.
The
junitPlatform
declaration moved intoandroid.testOptions
. This resonates with the canon of the Android Gradle Plugin's testing-related options. The old way is still usable, but deprecated with a log message.The JUnit 5 dependency handlers have been refactored yet again. With the first steps towards supporting instrumented tests, the current set of names didn't feel accurate enough anymore:
testImplementation junit5()
becomestestImplementation junit5.unitTests()
testImplementation junit5Params()
becomestestImplementation junit5.parameterized()
testCompileOnly junit5EmbeddedRuntime()
becomestestCompileOnly junit5.unitTestsRuntime()
Finally, there is a new dependency handler,
androidTestImplementation junit5.instrumentationTests()
, which applies the new android-instrumentation-test library.Every deprecated dependency handler is still usable for now, but triggers another log message.
There are some new configuration options related to instrumentation tests, which have been added to the
junitPlatform
closure. These parameters are grouped under the nameinstrumentationTests
inside that closure:junitPlatform.instrumentationTests.enabled
toggles support for instrumentation tests, and is false by default. JUnit 5 Instrumentation Tests require SDK 26, so it's going to be a long while before anyone is probably going to benefit from this. Setting this property to true is a requirement for being allowed to add the android-instrumentation-test library via the plugin, since it configures some other properties of a project in order to hack our way into the Test Instrumentation Runner.junitPlatform.instrumentationTests.version
is similar to the well-known version parameters for the JUnit 5 components, in that it allows users to override the recommended version of the android-instrumentation-test library manually.The Jacoco extension has been polished and extended to resemble its respective's plugin a little more. These parameters are still grouped under the name
jacoco
inside that closure:junitPlatform.jacoco.xml
,junitPlatform.jacoco.html
&junitPlatform.jacoco.csv
configure the state of each Jacoco Report respectively. Each one provides two parameters:enabled
toggles whether or not to generate the report in the first place,destination
may override where to write the report.xmlReport
,htmlReport
&csvReport
are still usable and delegate to the respectiveenabled
parameters of the new DSL, however they trigger yet another log message upon use.