Skip to content

Commit eb576a0

Browse files
committed
Update readme and bump versions to next snapshot
1 parent 58bd512 commit eb576a0

File tree

4 files changed

+76
-32
lines changed

4 files changed

+76
-32
lines changed

README.md

Lines changed: 68 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
-->
66
# <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]
77

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.**
8+
A Gradle plugin that allows for the execution of [JUnit 5][junit5gh] tests in Android environments using **Android Gradle Plugin 8.0.0 or later.**
99

1010
## How?
1111

@@ -22,20 +22,20 @@ To get started, declare the plugin in your `app` module's build script alongside
2222

2323
```kotlin
2424
plugins {
25-
id("de.mannodermaus.android-junit5") version "1.10.0.0"
25+
id("de.mannodermaus.android-junit5") version "1.10.2.0"
2626
}
2727

2828
dependencies {
2929
// (Required) Writing and executing Unit Tests on the JUnit Platform
30-
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0")
31-
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.0")
30+
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.2")
31+
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.2")
3232

3333
// (Optional) If you need "Parameterized Tests"
34-
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.0")
34+
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.2")
3535

3636
// (Optional) If you also have JUnit 4-based tests
3737
testImplementation("junit:junit:4.13.2")
38-
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.10.0")
38+
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.10.2")
3939
}
4040
```
4141
</details>
@@ -45,20 +45,20 @@ To get started, declare the plugin in your `app` module's build script alongside
4545

4646
```groovy
4747
plugins {
48-
id "de.mannodermaus.android-junit5" version "1.10.0.0"
48+
id "de.mannodermaus.android-junit5" version "1.10.2.0"
4949
}
5050
5151
dependencies {
5252
// (Required) Writing and executing Unit Tests on the JUnit Platform
53-
testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.0"
54-
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.10.0"
53+
testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.2"
54+
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.10.2"
5555
5656
// (Optional) If you need "Parameterized Tests"
57-
testImplementation "org.junit.jupiter:junit-jupiter-params:5.10.0"
57+
testImplementation "org.junit.jupiter:junit-jupiter-params:5.10.2"
5858
5959
// (Optional) If you also have JUnit 4-based tests
6060
testImplementation "junit:junit:4.13.2"
61-
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.10.0"
61+
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.10.2"
6262
}
6363
```
6464
</details>
@@ -76,7 +76,7 @@ If you prefer to use the legacy way to declare the dependency instead, remove th
7676
// In the root project's build.gradle.kts:
7777
buildscript {
7878
dependencies {
79-
classpath("de.mannodermaus.gradle.plugins:android-junit5:1.10.0.0")
79+
classpath("de.mannodermaus.gradle.plugins:android-junit5:1.10.2.0")
8080
}
8181
}
8282

@@ -94,7 +94,7 @@ If you prefer to use the legacy way to declare the dependency instead, remove th
9494
// In the root project's build.gradle:
9595
buildscript {
9696
dependencies {
97-
classpath "de.mannodermaus.gradle.plugins:android-junit5:1.10.0.0"
97+
classpath "de.mannodermaus.gradle.plugins:android-junit5:1.10.2.0"
9898
}
9999
}
100100
@@ -110,8 +110,8 @@ More information on Getting Started can be found [on the wiki][wiki-gettingstart
110110
## Requirements
111111

112112
The latest version of this plugin requires:
113-
* Android Gradle Plugin `7.0.0` or above
114-
* Gradle `7.0` or above
113+
* Android Gradle Plugin `8.0.0` or above
114+
* Gradle `8.0` or above
115115

116116
## Instrumentation Test Support
117117

@@ -124,7 +124,7 @@ Before you can write instrumentation tests with JUnit Jupiter, make sure that yo
124124

125125
```kotlin
126126
dependencies {
127-
androidTestImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0")
127+
androidTestImplementation("org.junit.jupiter:junit-jupiter-api:5.10.2")
128128
}
129129
```
130130
</details>
@@ -134,7 +134,7 @@ Before you can write instrumentation tests with JUnit Jupiter, make sure that yo
134134

135135
```groovy
136136
dependencies {
137-
androidTestImplementation "org.junit.jupiter:junit-jupiter-api:5.10.0"
137+
androidTestImplementation "org.junit.jupiter:junit-jupiter-api:5.10.2"
138138
}
139139
```
140140
</details>
@@ -154,8 +154,8 @@ Can you think of more? Let's discuss in the issues section!
154154
<summary>Kotlin</summary>
155155

156156
```kotlin
157-
dependencies {
158-
androidTestImplementation("de.mannodermaus.junit5:android-test-extensions:1.4.0")
157+
junitPlatform {
158+
instrumentationTests.includeExtensions.set(true)
159159
}
160160
```
161161
</details>
@@ -164,24 +164,25 @@ Can you think of more? Let's discuss in the issues section!
164164
<summary>Groovy</summary>
165165

166166
```groovy
167-
dependencies {
168-
androidTestImplementation "de.mannodermaus.junit5:android-test-extensions:1.4.0"
167+
junitPlatform {
168+
instrumentationTests.includeExtensions.set(true)
169169
}
170170
```
171171
</details>
172172

173173
### Jetpack Compose
174174

175175
To test `@Composable` functions on device with JUnit 5, first enable support for instrumentation tests as described above.
176-
Then, add the integration library for Jetpack Compose to the `androidTestImplementation` configuration:
176+
Then, add the Compose test dependency to your `androidTestImplementation` configuration
177+
and the plugin will autoconfigure JUnit 5 Compose support for you!
177178

178179
<details open>
179180
<summary>Kotlin</summary>
180181

181182
```kotlin
182183
dependencies {
183-
// Test extension & transitive dependencies
184-
androidTestImplementation("de.mannodermaus.junit5:android-test-compose:1.4.0")
184+
// Compose test framework
185+
androidTestImplementation("androidx.compose.ui:ui-test-android:$compose_version")
185186

186187
// Needed for createComposeExtension() and createAndroidComposeExtension()
187188
debugImplementation("androidx.compose.ui:ui-test-manifest:$compose_version")
@@ -194,8 +195,8 @@ Then, add the integration library for Jetpack Compose to the `androidTestImpleme
194195

195196
```groovy
196197
dependencies {
197-
// Test extension & transitive dependencies
198-
androidTestImplementation "de.mannodermaus.junit5:android-test-compose:1.4.0"
198+
// Compose test framework
199+
androidTestImplementation "androidx.compose.ui:ui-test-android:$compose_version"
199200
200201
// Needed for createComposeExtension() and createAndroidComposeExtension()
201202
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
@@ -205,21 +206,60 @@ Then, add the integration library for Jetpack Compose to the `androidTestImpleme
205206

206207
[The wiki][wiki-home] includes a section on how to test your Composables with JUnit 5.
207208

208-
# Official Support
209+
### Override the version of instrumentation test libraries
210+
211+
By default, the plugin will make sure to use a compatible version of the instrumentation test libraries
212+
when it sets up the artifacts automatically. However, it is possible to choose a custom version instead via its DSL:
213+
214+
<details open>
215+
<summary>Kotlin</summary>
216+
217+
```kotlin
218+
junitPlatform {
219+
instrumentationTests.version.set("1.5.0")
220+
}
221+
```
222+
</details>
223+
224+
<details>
225+
<summary>Groovy</summary>
226+
227+
```groovy
228+
junitPlatform {
229+
instrumentationTests.version.set("1.5.0")
230+
}
231+
```
232+
</details>
233+
234+
## Official Support
209235

210236
At this time, Google hasn't shared any immediate plans to bring first-party support for JUnit 5 to Android. The following list is an aggregation of pending feature requests:
211237

212238
- [InstantTaskExecutorRule uses @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) -- why? (issuetracker.google.com)](https://issuetracker.google.com/u/0/issues/79189568)
213239
- [Add support for JUnit 5 (issuetracker.google.com)](https://issuetracker.google.com/issues/127100532)
214240
- [JUnit 5 support (github.com/android/android-test)](https://github.com/android/android-test/issues/224)
215241

216-
# Building Locally
242+
## Building Locally
217243

218244
This repository contains multiple modules, divided into two sub-projects. The repository's root directory contains build logic shared across the sub-projects, which in turn use symlinks to connect to the common build scripts in their parent folder.
219245

220246
- `instrumentation`: The root folder for Android-based modules, namely the instrumentation libraries & a sample application. After cloning, open this project in Android Studio.
221247
- `plugin`: The root folder for Java-based modules, namely the Gradle plugin for JUnit 5 on Android, as well as its test module. After cloning, open this project in IntelliJ IDEA.
222248

249+
## Plugin Compatibility Map
250+
251+
For users that cannot match the current minimum version requirement of the Android Gradle Plugin requested by this plugin,
252+
refer to the table below to find a suitable alternative version. Note that **no active development will go into these
253+
legacy versions**, so please consider upgrading to at least Android Gradle Plugin 8.0.0
254+
before filing an issue with the latest one.
255+
256+
|Your AGP Version|Suggested JUnit5 Plugin Version|
257+
|---|---|
258+
|`7.0.0` - `7.4.2`|`1.10.0.0`|
259+
|`4.0.0` - `4.2.2`|`1.8.2.1`|
260+
|`3.5.0` - `3.6.4`|`1.7.1.1`|
261+
|`< 3.5.0`|none; you should **really** update your build env, bro|
262+
223263
## License
224264

225265
```

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ object Artifacts {
8888
platform = Java,
8989
groupId = "de.mannodermaus.gradle.plugins",
9090
artifactId = "android-junit5",
91-
currentVersion = "1.10.2.0",
92-
latestStableVersion = "1.10.0.0",
91+
currentVersion = "1.10.3.0-SNAPSHOT",
92+
latestStableVersion = "1.10.2.0",
9393
license = license,
9494
description = "Unit Testing with JUnit 5 for Android."
9595
)
@@ -99,8 +99,8 @@ object Artifacts {
9999
*/
100100
object Instrumentation {
101101
const val groupId = "de.mannodermaus.junit5"
102-
private const val currentVersion = "1.5.0"
103-
const val latestStableVersion = "1.4.0"
102+
private const val currentVersion = "1.5.1-SNAPSHOT"
103+
const val latestStableVersion = "1.5.0"
104104

105105
val Core = Deployed(
106106
platform = Android(minSdk = 19),

instrumentation/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ Change Log
33

44
## Unreleased
55

6+
## 1.5.0 (2024-07-25)
7+
68
- Fix inheritance hierarchy of `ComposeExtension` to avoid false-positive warning regarding `@RegisterExtension` (#318)
79
- Improve parallel test execution for Android instrumentation tests
810
- Fix invalid naming of dynamic tests when executing only a singular test method from the IDE (#317, #339)

plugin/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ Change Log
22
==========
33

44
## Unreleased
5+
6+
## 1.10.2.0 (2024-07-25)
57
- JUnit 5.10.2
68
- Raise minimum supported versions for AGP and Gradle to 8.0.x and 8.0, respectively
79
- Allow overriding the version of the instrumentation libraries applied with the plugin

0 commit comments

Comments
 (0)