Skip to content

Commit 0363d60

Browse files
author
Marcel Schnelle
authored
Update readme file for 1.2.0 (#104)
1 parent d2905c0 commit 0363d60

File tree

2 files changed

+46
-58
lines changed

2 files changed

+46
-58
lines changed

README.md

+45-57
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,11 @@
22

33
![Logo](.images/logo.png)
44

5-
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.**
5+
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.**
66

7-
## Why a separate plugin?
7+
## How?
88

9-
The JUnit Platform team provides a Gradle plugin for running JUnit 5 on the JVM. However,
10-
that plugin is tailored to the needs of a "purely Java" application, and doesn't work in
11-
the context of the multi-variant world that we live in on Android. As a result, `android-junit5` was born.
12-
13-
This plugin configures a `junitPlatformTest` task for each registered build variant of a project.
14-
Furthermore, it automatically attaches both the Jupiter & Vintage Engines
15-
during the execution phase of your tests as well, so there's very little configuration
16-
necessary to get your project up-and-running on the JUnit Platform.
9+
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`.
1710

1811
Instructions on how to write JUnit 5 tests can be found [in their User Guide][junit5ug].
1912
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
2316
```groovy
2417
buildscript {
2518
dependencies {
26-
classpath "de.mannodermaus.gradle.plugins:android-junit5:1.0.32"
19+
classpath "de.mannodermaus.gradle.plugins:android-junit5:1.2.0.0"
2720
}
2821
}
2922
```
@@ -36,62 +29,58 @@ Snapshots of the development version are available through [Sonatype's `snapshot
3629
apply plugin: "de.mannodermaus.android-junit5"
3730
3831
dependencies {
39-
// (Required) Writing and executing Unit Tests on the JUnit Platform.
40-
testImplementation junit5.unitTests()
41-
42-
// (Optional) If you need "Parameterized Tests".
43-
testImplementation junit5.parameterized()
44-
45-
// (Optional) Writing and executing Instrumented Tests with the JUnit Platform Runner.
46-
//
47-
// IMPORTANT:
48-
// By declaring this dependency, you have to use a minSdkVersion
49-
// of at least 26, since the nature of JUnit 5 relies on APIs that aren't
50-
// available on Android devices before then.
51-
// Consider creating a product flavor for this - see the sample project for details.
52-
androidTestImplementation junit5.instrumentationTests()
32+
// (Required) Writing and executing Unit Tests on the JUnit Platform
33+
testImplementation "org.junit.jupiter:junit-jupiter-api:5.2.0"
34+
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.2.0"
35+
36+
// (Optional) If you need "Parameterized Tests"
37+
testImplementation "org.junit.jupiter:junit-jupiter-params:5.2.0"
38+
39+
// (Optional) If you also have JUnit 4-based tests
40+
testImplementation "junit:junit:4.12"
41+
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.2.0"
5342
}
5443
```
5544

56-
## Configuration
45+
More information on Getting Started can be found [on the wiki][wiki-gettingstarted].
5746

58-
The plugin can be configured through a new configuration container inside `android.testOptions`.
59-
Please check out the [Wiki page][wikiconfigpage] for an overview of the available DSL.
47+
## Requirements
6048

61-
## Gradle Compatibility
49+
The latest version of this plugin requires:
50+
* Android Gradle Plugin `3.2.0` or above
51+
* Gradle `4.7` or above
6252

63-
The plugin's minimum required version of Gradle has increased over time to maximize its leverage with new APIs and performance.
64-
The chart describes the evolution of this requirement. If you can't use the latest version of this plugin due to your
65-
project's Gradle version, please refer to the following table to find the corresponding plugin that works for you.
53+
## Instrumentation Test Support
6654

67-
|Plugin Version|Minimum Gradle Version|
68-
|---|---|
69-
|`1.0.30` and older|`2.5`|
70-
|`1.0.31` and later|`4.3`|
55+
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`.
7156

72-
## Licenses
57+
To include the experimental instrumentation test support, add the following to your `build.gradle`:
7358

74-
#### android-junit5-embedded-runtime:
59+
```groovy
60+
android {
61+
deaultConfig {
62+
// (Required) Make sure to use the AndroidJUnitRunner, of a subclass of it
63+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
64+
// (Required) Connect JUnit 5 to the runner
65+
testInstrumentationRunnerArgument "runnerBuilder", "de.mannodermaus.junit5.AndroidJUnit5Builder"
66+
}
67+
}
68+
dependencies {
69+
// (Required) Writing tests for JUnit Jupiter
70+
// Note: Including the Engine as well is not required for instrumentation tests
71+
androidTestImplementation "org.junit.jupiter:junit-jupiter-api:5.2.0"
7572
73+
// (Required) Instrumentation test libraries
74+
androidTestImplementation "de.mannodermaus.junit5:android-instrumentation-test:0.2.2"
75+
androidTestRuntimeOnly "de.mannodermaus.junit5:android-instrumentation-test-runner:0.2.2"
76+
}
7677
```
77-
Copyright 2000-2016 JetBrains s.r.o.
78-
79-
Licensed under the Apache License, Version 2.0 (the "License");
80-
you may not use this file except in compliance with the License.
81-
You may obtain a copy of the License at
8278

83-
http://www.apache.org/licenses/LICENSE-2.0
84-
85-
Unless required by applicable law or agreed to in writing, software
86-
distributed under the License is distributed on an "AS IS" BASIS,
87-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
88-
See the License for the specific language governing permissions and
89-
limitations under the License.
90-
```
79+
# Migration from 1.0.x
9180

92-
See also the [full License text](android-junit5-embedded-runtime/LICENSE).
81+
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.
9382

94-
#### Everything else:
83+
## License
9584

9685
```
9786
Copyright 2017-2018 Marcel Schnelle
@@ -113,10 +102,9 @@ See also the [full License text](LICENSE).
113102

114103
[junit5gh]: https://github.com/junit-team/junit5
115104
[junit5ug]: https://junit.org/junit5/docs/current/user-guide
116-
[junit5config]: http://junit.org/junit5/docs/current/user-guide/#running-tests-build-gradle-junit-configure
117105
[travisci]: https://travis-ci.org/mannodermaus/android-junit5
118-
[as2issue]: https://github.com/mannodermaus/android-junit5/issues/19
119-
[jacoco]: http://www.eclemma.org/jacoco
120106
[sonatyperepo]: https://oss.sonatype.org/content/repositories/snapshots
121107
[sampletests]: sample/src/test
122-
[wikiconfigpage]: https://github.com/mannodermaus/android-junit5/wiki/Configuration-DSL
108+
[wiki-dsl]: https://github.com/mannodermaus/android-junit5/wiki/Configuration-DSL
109+
[wiki-migration]: https://github.com/mannodermaus/android-junit5/wiki/Migrating-from-1.0.x
110+
[wiki-gettingstarted]: https://github.com/mannodermaus/android-junit5/wiki/Getting-Started

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LICENSE_NAME = Apache-2.0
1212
PLUGIN_GROUP_ID = de.mannodermaus.gradle.plugins
1313
PLUGIN_ARTIFACT_ID = android-junit5
1414
PLUGIN_DESCRIPTION = Unit Testing with JUnit 5 for Android.
15-
PLUGIN_VERSION_NAME = 1.2.0-SNAPSHOT
15+
PLUGIN_VERSION_NAME = 1.2.0.0
1616
PLUGIN_VERSION_NAME_LATEST_STABLE = 1.0.32
1717

1818
# Artifact configuration (instrumentation & runner)

0 commit comments

Comments
 (0)