Skip to content

DSL Polishing & Migration #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Dec 3, 2017
Merged

DSL Polishing & Migration #39

merged 12 commits into from
Dec 3, 2017

Conversation

mannodermaus
Copy link
Owner

This is a combined PR with the results of moving around the different parts of the JUnit Platform DSL exposed by the plugin.

  1. The junitPlatform declaration moved into android.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.

  2. 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() becomes testImplementation junit5.unitTests()
    • testImplementation junit5Params() becomes testImplementation junit5.parameterized()
    • testCompileOnly junit5EmbeddedRuntime() becomes testCompileOnly 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.

  3. There are some new configuration options related to instrumentation tests, which have been added to the junitPlatform closure. These parameters are grouped under the name instrumentationTests 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.
  4. 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 respective enabled parameters of the new DSL, however they trigger yet another log message upon use.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…y handlers

Dependency Handlers:
* Replaced junit5() with junit5.unitTests()
* Replaced junit5Params() with junit5.parameterized()
* Replaced junit5EmbeddedRuntime() with junit5.unitTestsRuntime()
* Added junit5.instrumentationTests()

(Backwards-compatible versions of the old handlers are still available,
however they log a warning when used.)

Moved junitPlatform DSL from <root> to android.testOptions

(Backwards-compatible usage of the old DSL location is still allowed,
however that logs a warning when used.)
@mannodermaus mannodermaus merged commit 6f1db59 into master Dec 3, 2017
@mannodermaus mannodermaus deleted the config-migration branch December 3, 2017 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant