Skip to content

Commit c46b02c

Browse files
committed
Readme & changelog for 1.9.0.0, prepare next version
1 parent 486d154 commit c46b02c

File tree

4 files changed

+92
-115
lines changed

4 files changed

+92
-115
lines changed

README.md

Lines changed: 88 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
To update the content of this README, please apply modifications
44
to `README.md.template` instead, and run the `generateReadme` task from Gradle.
55
-->
6-
76
# <img src=".images/logo.png" align="right" width="100">android-junit5 [![CircleCI](https://circleci.com/gh/mannodermaus/android-junit5/tree/main.svg?style=svg)][circleci]
87

9-
A Gradle plugin that allows for the execution of [JUnit 5][junit5gh] tests in Android environments using **Android Gradle Plugin 4.0.0 or later.**
8+
A Gradle plugin that allows for the execution of [JUnit 5][junit5gh] tests in Android environments using **Android Gradle Plugin 7.0.0 or later.**
109

1110
## How?
1211

@@ -21,49 +20,47 @@ To get started, declare the plugin in your `app` module's build script alongside
2120
<details open>
2221
<summary>Kotlin</summary>
2322

24-
```kotlin
25-
plugins {
26-
id("de.mannodermaus.android-junit5") version "1.8.2.1"
27-
}
28-
29-
dependencies {
30-
// (Required) Writing and executing Unit Tests on the JUnit Platform
31-
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
32-
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2")
23+
```kotlin
24+
plugins {
25+
id("de.mannodermaus.android-junit5") version "1.9.0.0"
26+
}
3327

34-
// (Optional) If you need "Parameterized Tests"
35-
testImplementation("org.junit.jupiter:junit-jupiter-params:5.8.2")
28+
dependencies {
29+
// (Required) Writing and executing Unit Tests on the JUnit Platform
30+
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.0")
31+
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.0")
3632

37-
// (Optional) If you also have JUnit 4-based tests
38-
testImplementation("junit:junit:4.13.2")
39-
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.8.2")
40-
}
41-
```
33+
// (Optional) If you need "Parameterized Tests"
34+
testImplementation("org.junit.jupiter:junit-jupiter-params:5.9.0")
4235

36+
// (Optional) If you also have JUnit 4-based tests
37+
testImplementation("junit:junit:4.13.2")
38+
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.9.0")
39+
}
40+
```
4341
</details>
4442

4543
<details>
4644
<summary>Groovy</summary>
4745

48-
```groovy
49-
plugins {
50-
id "de.mannodermaus.android-junit5" version "1.8.2.1"
51-
}
52-
53-
dependencies {
54-
// (Required) Writing and executing Unit Tests on the JUnit Platform
55-
testImplementation "org.junit.jupiter:junit-jupiter-api:5.8.2"
56-
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.8.2"
46+
```groovy
47+
plugins {
48+
id "de.mannodermaus.android-junit5" version "1.9.0.0"
49+
}
5750
58-
// (Optional) If you need "Parameterized Tests"
59-
testImplementation "org.junit.jupiter:junit-jupiter-params:5.8.2"
51+
dependencies {
52+
// (Required) Writing and executing Unit Tests on the JUnit Platform
53+
testImplementation "org.junit.jupiter:junit-jupiter-api:5.9.0"
54+
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.9.0"
6055
61-
// (Optional) If you also have JUnit 4-based tests
62-
testImplementation "junit:junit:4.13.2"
63-
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.8.2"
64-
}
65-
```
56+
// (Optional) If you need "Parameterized Tests"
57+
testImplementation "org.junit.jupiter:junit-jupiter-params:5.9.0"
6658
59+
// (Optional) If you also have JUnit 4-based tests
60+
testImplementation "junit:junit:4.13.2"
61+
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.9.0"
62+
}
63+
```
6764
</details>
6865

6966
<br/>
@@ -75,27 +72,25 @@ If you prefer to use the legacy way to declare the dependency instead, remove th
7572
<details>
7673
<summary>Kotlin</summary>
7774

78-
```kotlin
79-
buildscript {
80-
dependencies {
81-
classpath("de.mannodermaus.gradle.plugins:android-junit5:1.8.2.1")
75+
```kotlin
76+
buildscript {
77+
dependencies {
78+
classpath("de.mannodermaus.gradle.plugins:android-junit5:1.9.0.0")
79+
}
8280
}
83-
}
84-
```
85-
81+
```
8682
</details>
8783

8884
<details>
8985
<summary>Groovy</summary>
9086

91-
```kotlin
92-
buildscript {
93-
dependencies {
94-
classpath "de.mannodermaus.gradle.plugins:android-junit5:1.8.2.1"
87+
```kotlin
88+
buildscript {
89+
dependencies {
90+
classpath "de.mannodermaus.gradle.plugins:android-junit5:1.9.0.0"
91+
}
9592
}
96-
}
97-
```
98-
93+
```
9994
</details>
10095

10196
<br/>
@@ -105,81 +100,62 @@ More information on Getting Started can be found [on the wiki][wiki-gettingstart
105100
## Requirements
106101

107102
The latest version of this plugin requires:
108-
109-
- Android Gradle Plugin `4.0.0` or above
110-
- Gradle `6.1.1` or above
103+
* Android Gradle Plugin `7.0.0` or above
104+
* Gradle `7.0` or above
111105

112106
## Instrumentation Test Support
113107

114-
There is experimental support for Android instrumentation tests, which requires some additional configuration & dependencies. Furthermore, because JUnit 5 is built on Java 8 from the ground up, its instrumentation tests will only run on devices running Android 8.0 (API 26) or newer. Older phones will skip the execution of these tests completely, marking them as "ignored".
108+
You can use JUnit 5 to run instrumentation tests on emulators and physical devices, too. Because the framework is built on Java 8 from the ground up, these instrumentation tests will only run on devices running Android 8.0 (API 26) or newer – older phones will skip the execution of these tests completely, marking them as "ignored".
115109

116-
To start writing instrumentation tests with JUnit Jupiter, make the following changes to your module's build script:
110+
Before you can write instrumentation tests with JUnit Jupiter, make sure that your module is using the `androidx.test.runner.AndroidJUnitRunner` (or a subclass of it) as its `testInstrumentationRunner`. Then, simply add a dependency on `junit-jupiter-api` to the `androidTestImplementation` configuration in your build script and the plugin will automatically configure JUnit 5 tests for you:
117111

118112
<details open>
119113
<summary>Kotlin</summary>
120114

121115
```kotlin
122-
android {
123-
defaultConfig {
124-
// 1) Make sure to use the AndroidJUnitRunner, or a subclass of it. This requires a dependency on androidx.test:runner, too!
125-
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
126-
// 2) Connect JUnit 5 to the runner
127-
testInstrumentationRunnerArguments["runnerBuilder"] = "de.mannodermaus.junit5.AndroidJUnit5Builder"
128-
}
116+
dependencies {
117+
androidTestImplementation("org.junit.jupiter:junit-jupiter-api:5.9.0")
118+
}
119+
```
120+
</details>
129121

130-
// 3) Java 8 is required
131-
compileOptions {
132-
setSourceCompatibility(JavaVersion.VERSION_1_8)
133-
setTargetCompatibility(JavaVersion.VERSION_1_8)
134-
}
135-
}
122+
<details>
123+
<summary>Groovy</summary>
136124

137-
dependencies {
138-
// 4) Jupiter API & Test Runner, if you don't have it already
139-
androidTestImplementation("androidx.test:runner:1.4.0")
140-
androidTestImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
125+
```groovy
126+
dependencies {
127+
androidTestImplementation "org.junit.jupiter:junit-jupiter-api:5.9.0"
128+
}
129+
```
130+
</details>
141131

142-
// 5) The instrumentation test companion libraries
143-
androidTestImplementation("de.mannodermaus.junit5:android-test-core:1.3.0")
144-
androidTestRuntimeOnly("de.mannodermaus.junit5:android-test-runner:1.3.0")
145-
}
146-
```
132+
By enabling JUnit 5 for instrumentation tests, you will gain access to `ActivityScenarioExtension` (amog other things), which helps with the orchestration of `Activity` classes. Check [the wiki][wiki-home] for more info.
147133

148-
</details>
134+
## Jetpack Compose
149135

150-
<details>
151-
<summary>Groovy</summary>
152-
153-
```groovy
154-
android {
155-
defaultConfig {
156-
// 1) Make sure to use the AndroidJUnitRunner, or a subclass of it. This requires a dependency on androidx.test:runner, too!
157-
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
158-
// 2) Connect JUnit 5 to the runner
159-
testInstrumentationRunnerArgument "runnerBuilder", "de.mannodermaus.junit5.AndroidJUnit5Builder"
160-
}
136+
Support for Jetpack Compose is in the works, but considered experimental and unstable at this stage. To use it, first enable support for instrumentation tests as described above, then add the integration library for Jetpack Compose as well:
161137

162-
// 3) Java 8 is required
163-
compileOptions {
164-
sourceCompatibility JavaVersion.VERSION_1_8
165-
targetCompatibility JavaVersion.VERSION_1_8
138+
<details open>
139+
<summary>Kotlin</summary>
140+
141+
```kotlin
142+
dependencies {
143+
androidTestImplementation("de.mannodermaus.junit5:android-test-compose:0.1.0-SNAPSHOT")
166144
}
167-
}
168-
169-
dependencies {
170-
// 4) Jupiter API & Test Runner, if you don't have it already
171-
androidTestImplementation "androidx.test:runner:1.4.0"
172-
androidTestImplementation "org.junit.jupiter:junit-jupiter-api:5.8.2"
145+
```
146+
</details>
173147

174-
// 5) The instrumentation test companion libraries
175-
androidTestImplementation "de.mannodermaus.junit5:android-test-core:1.3.0"
176-
androidTestRuntimeOnly "de.mannodermaus.junit5:android-test-runner:1.3.0"
177-
}
178-
````
148+
<details>
149+
<summary>Groovy</summary>
179150

151+
```groovy
152+
dependencies {
153+
androidTestImplementation "de.mannodermaus.junit5:android-test-compose:0.1.0-SNAPSHOT"
154+
}
155+
```
180156
</details>
181157

182-
The `android-test-core` artifact includes an extension point for the `ActivityScenario` API; more information on that can be found in the wiki.
158+
[The wiki][wiki-home] includes a section on how to test your Composables with JUnit 5.
183159

184160
# Official Support
185161

@@ -199,7 +175,7 @@ This repository contains multiple modules, divided into two sub-projects. The re
199175
## License
200176

201177
```
202-
Copyright 2017-2022 Marcel Schnelle
178+
Copyright 2017-2023 Marcel Schnelle
203179
204180
Licensed under the Apache License, Version 2.0 (the "License");
205181
you may not use this file except in compliance with the License.
@@ -216,10 +192,11 @@ limitations under the License.
216192

217193
See also the [full License text](LICENSE).
218194

219-
[junit5gh]: https://github.com/junit-team/junit5
220-
[junit5ug]: https://junit.org/junit5/docs/current/user-guide
221-
[circleci]: https://circleci.com/gh/mannodermaus/android-junit5
222-
[sonatyperepo]: https://oss.sonatype.org/content/repositories/snapshots
223-
[sampletests]: instrumentation/sample
224-
[wiki-dsl]: https://github.com/mannodermaus/android-junit5/wiki/Configuration-DSL
225-
[wiki-gettingstarted]: https://github.com/mannodermaus/android-junit5/wiki/Getting-Started
195+
[junit5gh]: https://github.com/junit-team/junit5
196+
[junit5ug]: https://junit.org/junit5/docs/current/user-guide
197+
[circleci]: https://circleci.com/gh/mannodermaus/android-junit5
198+
[sonatyperepo]: https://oss.sonatype.org/content/repositories/snapshots
199+
[sampletests]: instrumentation/sample
200+
[wiki-home]: https://github.com/mannodermaus/android-junit5/wiki
201+
[wiki-dsl]: https://github.com/mannodermaus/android-junit5/wiki/Configuration
202+
[wiki-gettingstarted]: https://github.com/mannodermaus/android-junit5/wiki/Getting-Started

README.md.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ This repository contains multiple modules, divided into two sub-projects. The re
170170
## License
171171

172172
```
173-
Copyright 2017-2022 Marcel Schnelle
173+
Copyright 2017-2023 Marcel Schnelle
174174

175175
Licensed under the Apache License, Version 2.0 (the "License");
176176
you may not use this file except in compliance with the License.

build-logic/src/main/kotlin/Environment.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ object Artifacts {
8787
platform = Java,
8888
groupId = "de.mannodermaus.gradle.plugins",
8989
artifactId = "android-junit5",
90-
currentVersion = "1.9.0.0",
91-
latestStableVersion = "1.8.2.1",
90+
currentVersion = "1.9.1.0-SNAPSHOT",
91+
latestStableVersion = "1.9.0.0",
9292
license = license,
9393
description = "Unit Testing with JUnit 5 for Android."
9494
)

plugin/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Change Log
33

44
## Unreleased
55

6-
## 1.9.0.0 (2023-04-28)
6+
## 1.9.0.0 (2023-04-29)
77
- JUnit 5.9.0
88
- Add support for Android Gradle Plugin 8.x.y
99
- Raise minimum supported versions for AGP and Gradle to 7.0.x and 7.0, respectively

0 commit comments

Comments
 (0)