From 64956d4b8fc3bca23203377dd957f5cd87463b25 Mon Sep 17 00:00:00 2001 From: Marcel Schnelle Date: Sun, 22 Jul 2018 20:45:44 +0200 Subject: [PATCH 1/4] Update readme file --- README.md | 94 ++++++++++++++++++++++--------------------------------- 1 file changed, 38 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index e546b89d..e72a2ff9 100644 --- a/README.md +++ b/README.md @@ -2,18 +2,11 @@ ![Logo](.images/logo.png) -A Gradle plugin that allows for the execution of [JUnit 5][junit5gh] tests in Android environments using **Android Gradle Plugin 3.0.0 or later.** +A Gradle plugin that allows for the execution of [JUnit 5][junit5gh] tests in Android environments using **Android Gradle Plugin 3.2.0 or later.** -## Why a separate plugin? +## How? -The JUnit Platform team provides a Gradle plugin for running JUnit 5 on the JVM. However, -that plugin is tailored to the needs of a "purely Java" application, and doesn't work in -the context of the multi-variant world that we live in on Android. As a result, `android-junit5` was born. - -This plugin configures a `junitPlatformTest` task for each registered build variant of a project. -Furthermore, it automatically attaches both the Jupiter & Vintage Engines -during the execution phase of your tests as well, so there's very little configuration -necessary to get your project up-and-running on the JUnit Platform. +This plugin configures the unit test tasks for each build variant of a project to run on the JUnit Platform. Furthermore, it provides additional configuration options for these tests [through a DSL][wiki-dsl] attached to `android.testOptions`. Instructions on how to write JUnit 5 tests can be found [in their User Guide][junit5ug]. Furthermore, this repository provides a small showcase of the functionality provided by JUnit 5 [here][sampletests]. @@ -23,7 +16,7 @@ Furthermore, this repository provides a small showcase of the functionality prov ```groovy buildscript { dependencies { - classpath "de.mannodermaus.gradle.plugins:android-junit5:1.0.32" + classpath "de.mannodermaus.gradle.plugins:android-junit5:1.2.0" } } ``` @@ -37,61 +30,51 @@ apply plugin: "de.mannodermaus.android-junit5" dependencies { // (Required) Writing and executing Unit Tests on the JUnit Platform. - testImplementation junit5.unitTests() + testImplementation "org.junit.jupiter:junit-jupiter-api:5.2.0" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.2.0" // (Optional) If you need "Parameterized Tests". - testImplementation junit5.parameterized() - - // (Optional) Writing and executing Instrumented Tests with the JUnit Platform Runner. - // - // IMPORTANT: - // By declaring this dependency, you have to use a minSdkVersion - // of at least 26, since the nature of JUnit 5 relies on APIs that aren't - // available on Android devices before then. - // Consider creating a product flavor for this - see the sample project for details. - androidTestImplementation junit5.instrumentationTests() + testImplementation "org.junit.jupiter:junit-jupiter-params:5.2.0" + + // (Optional) If you also have JUnit 4-based tests. + testImplementation "junit:junit:4.12" + testImplementation "org.junit.vintage:junit-vintage-engine:5.2.0" } ``` -## Configuration - -The plugin can be configured through a new configuration container inside `android.testOptions`. -Please check out the [Wiki page][wikiconfigpage] for an overview of the available DSL. +## Requirements -## Gradle Compatibility +The latest version of this plugin requires: +* Android Gradle Plugin `3.2.0` or above +* Gradle `4.7` or above -The plugin's minimum required version of Gradle has increased over time to maximize its leverage with new APIs and performance. -The chart describes the evolution of this requirement. If you can't use the latest version of this plugin due to your -project's Gradle version, please refer to the following table to find the corresponding plugin that works for you. +## Instrumentation Test Support -|Plugin Version|Minimum Gradle Version| -|---|---| -|`1.0.30` and older|`2.5`| -|`1.0.31` and later|`4.3`| +There is experimental support for Android instrumentation tests, which requires some additional configuration & dependencies. Note that since JUnit 5 is based from the ground up on Java 8, the libraries require you to have a `minSdkVersion` of at least `26`. -## Licenses - -#### android-junit5-embedded-runtime: +To include the experimental instrumentation test support, add the following to your `build.gradle`: +```groovy +android { + deaultConfig { + // (Required) Make sure to use the AndroidJUnitRunner, of a subclass of it + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + // (Required) Connect JUnit 5 to the runner + testInstrumentationRunnerArgument "runnerBuilder", "de.mannodermaus.junit5.AndroidJUnit5Builder" + } +} +dependencies { + // (Required) Instrumentation test libraries + androidTestImplementation " de.mannodermaus.junit5:android-instrumentation-test:0.2.2" + androidTestRuntimeOnly "de.mannodermaus.junit5:android-instrumentation-test-runner:0.2.2" +} ``` -Copyright 2000-2016 JetBrains s.r.o. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -``` +# Migration from 1.0.x -See also the [full License text](android-junit5-embedded-runtime/LICENSE). +Since the move to utilize the native JUnit 5 support built into the build system, a lot has changed from the previous version of the plugin. Users seeking to migrate to the new version are encouraged to check out the migration guide located [on the Wiki][wiki-migration] of this repository. -#### Everything else: +## License ``` Copyright 2017-2018 Marcel Schnelle @@ -113,10 +96,9 @@ See also the [full License text](LICENSE). [junit5gh]: https://github.com/junit-team/junit5 [junit5ug]: https://junit.org/junit5/docs/current/user-guide - [junit5config]: http://junit.org/junit5/docs/current/user-guide/#running-tests-build-gradle-junit-configure [travisci]: https://travis-ci.org/mannodermaus/android-junit5 - [as2issue]: https://github.com/mannodermaus/android-junit5/issues/19 - [jacoco]: http://www.eclemma.org/jacoco [sonatyperepo]: https://oss.sonatype.org/content/repositories/snapshots [sampletests]: sample/src/test - [wikiconfigpage]: https://github.com/mannodermaus/android-junit5/wiki/Configuration-DSL + [wiki-dsl]: https://github.com/mannodermaus/android-junit5/wiki/Configuration-DSL + [wiki-migration]: https://github.com/mannodermaus/android-junit5/wiki/Migrating-from-1.0.x +[wiki-] \ No newline at end of file From 58158b38e7693048785d2ba07074502d6cc729f7 Mon Sep 17 00:00:00 2001 From: Marcel Schnelle Date: Sun, 22 Jul 2018 21:18:40 +0200 Subject: [PATCH 2/4] Update readme --- README.md | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e72a2ff9..1de11c3a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![Logo](.images/logo.png) -A Gradle plugin that allows for the execution of [JUnit 5][junit5gh] tests in Android environments using **Android Gradle Plugin 3.2.0 or later.** +A Gradle plugin that allows for the execution of [JUnit 5][junit5gh] tests in Android environments using **Android Gradle Plugin 3.1.3 or later.** ## How? @@ -29,28 +29,30 @@ Snapshots of the development version are available through [Sonatype's `snapshot apply plugin: "de.mannodermaus.android-junit5" dependencies { - // (Required) Writing and executing Unit Tests on the JUnit Platform. + // (Required) Writing and executing Unit Tests on the JUnit Platform testImplementation "org.junit.jupiter:junit-jupiter-api:5.2.0" testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.2.0" - // (Optional) If you need "Parameterized Tests". + // (Optional) If you need "Parameterized Tests" testImplementation "org.junit.jupiter:junit-jupiter-params:5.2.0" - // (Optional) If you also have JUnit 4-based tests. + // (Optional) If you also have JUnit 4-based tests testImplementation "junit:junit:4.12" testImplementation "org.junit.vintage:junit-vintage-engine:5.2.0" } ``` +More information on Getting Started can be found [on the wiki][wiki-gettingstarted]. + ## Requirements The latest version of this plugin requires: -* Android Gradle Plugin `3.2.0` or above +* Android Gradle Plugin `3.1.3` or above * Gradle `4.7` or above ## Instrumentation Test Support -There is experimental support for Android instrumentation tests, which requires some additional configuration & dependencies. Note that since JUnit 5 is based from the ground up on Java 8, the libraries require you to have a `minSdkVersion` of at least `26`. +There is experimental support for Android instrumentation tests, which requires some additional configuration & dependencies. Note that since JUnit 5 is built on Java 8 from the ground up, these libraries require you to have a `minSdkVersion` of at least `26`. To include the experimental instrumentation test support, add the following to your `build.gradle`: @@ -64,15 +66,19 @@ android { } } dependencies { + // (Required) Writing tests for JUnit Jupiter + // Note: Including the Engine as well is not required for instrumentation tests + androidTestImplementation "org.junit.jupiter:junit-jupiter-api:5.2.0" + // (Required) Instrumentation test libraries - androidTestImplementation " de.mannodermaus.junit5:android-instrumentation-test:0.2.2" + androidTestImplementation "de.mannodermaus.junit5:android-instrumentation-test:0.2.2" androidTestRuntimeOnly "de.mannodermaus.junit5:android-instrumentation-test-runner:0.2.2" } ``` # Migration from 1.0.x -Since the move to utilize the native JUnit 5 support built into the build system, a lot has changed from the previous version of the plugin. Users seeking to migrate to the new version are encouraged to check out the migration guide located [on the Wiki][wiki-migration] of this repository. +Since the move to utilize the native JUnit 5 support built into the build system, a lot has changed from the previous version of the plugin. Users seeking to migrate to the new version are encouraged to check out the migration guide located [on the Wiki][wiki-migration] of this repository. ## License @@ -101,4 +107,4 @@ See also the [full License text](LICENSE). [sampletests]: sample/src/test [wiki-dsl]: https://github.com/mannodermaus/android-junit5/wiki/Configuration-DSL [wiki-migration]: https://github.com/mannodermaus/android-junit5/wiki/Migrating-from-1.0.x -[wiki-] \ No newline at end of file + [wiki-gettingstarted]: https://github.com/mannodermaus/android-junit5/wiki/Getting-Started \ No newline at end of file From 4ebfe12279bde555912a3bcb830327354eedcf2a Mon Sep 17 00:00:00 2001 From: Marcel Schnelle Date: Mon, 23 Jul 2018 06:17:08 +0200 Subject: [PATCH 3/4] Revert --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1de11c3a..667d7349 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![Logo](.images/logo.png) -A Gradle plugin that allows for the execution of [JUnit 5][junit5gh] tests in Android environments using **Android Gradle Plugin 3.1.3 or later.** +A Gradle plugin that allows for the execution of [JUnit 5][junit5gh] tests in Android environments using **Android Gradle Plugin 3.2.0 or later.** ## How? @@ -16,7 +16,7 @@ Furthermore, this repository provides a small showcase of the functionality prov ```groovy buildscript { dependencies { - classpath "de.mannodermaus.gradle.plugins:android-junit5:1.2.0" + classpath "de.mannodermaus.gradle.plugins:android-junit5:1.2.0.0" } } ``` @@ -47,7 +47,7 @@ More information on Getting Started can be found [on the wiki][wiki-gettingstart ## Requirements The latest version of this plugin requires: -* Android Gradle Plugin `3.1.3` or above +* Android Gradle Plugin `3.2.0` or above * Gradle `4.7` or above ## Instrumentation Test Support From df38faee8d919bf7eba4b5ad68519a7880996c39 Mon Sep 17 00:00:00 2001 From: Marcel Schnelle Date: Fri, 27 Jul 2018 18:07:31 +0200 Subject: [PATCH 4/4] Fix readme mistake and bump to 1.2.0.0 --- README.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 667d7349..15b5820c 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ dependencies { // (Optional) If you also have JUnit 4-based tests testImplementation "junit:junit:4.12" - testImplementation "org.junit.vintage:junit-vintage-engine:5.2.0" + testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.2.0" } ``` diff --git a/gradle.properties b/gradle.properties index b8d6f311..ffd7448f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ LICENSE_NAME = Apache-2.0 PLUGIN_GROUP_ID = de.mannodermaus.gradle.plugins PLUGIN_ARTIFACT_ID = android-junit5 PLUGIN_DESCRIPTION = Unit Testing with JUnit 5 for Android. -PLUGIN_VERSION_NAME = 1.2.0-SNAPSHOT +PLUGIN_VERSION_NAME = 1.2.0.0 PLUGIN_VERSION_NAME_LATEST_STABLE = 1.0.32 # Artifact configuration (instrumentation & runner)