You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# <imgsrc=".images/logo.png"align="right"width="100">JUnit Jupiter for Android[][circleci]
7
7
8
-
A Gradle plugin that allows for the execution of [JUnit 5][junit5gh] tests in Android environments using **Android Gradle Plugin 8.2 or later.**
8
+
A Gradle plugin that allows for the execution of [JUnit Jupiter][junitgh] tests in Android environments using **Android Gradle Plugin 8.2 or later.**
9
9
10
10
## How?
11
11
12
-
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] and facilitates the usage of JUnit 5 for instrumentation tests.
12
+
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] and facilitates the usage of JUnit Jupiter for instrumentation tests.
13
13
14
-
Instructions on how to write tests with the JUnit 5 framework can be found [in their User Guide][junit5ug]. To get a first look at its features, a small showcase project can be found [here][sampletests].
14
+
Instructions on how to write tests with the JUnit framework can be found [in their User Guide][junitug]. To get a first look at its features, a small showcase project can be found [here][sampletests].
15
15
16
16
## Setup
17
17
@@ -27,15 +27,15 @@ To get started, declare the plugin in your `app` module's build script alongside
27
27
28
28
dependencies {
29
29
// (Required) Writing and executing Unit Tests on the JUnit Platform
@@ -115,16 +115,16 @@ The latest version of this plugin requires:
115
115
116
116
## Instrumentation Test Support
117
117
118
-
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".
118
+
You can use JUnit Jupiter to run instrumentation tests on emulators and physical devices, too. Because the framework is built on Java 17 from the ground up, these instrumentation tests will only run on devices running Android 15 (API 35) or newer – older phones will skip the execution of these tests completely, marking them as "ignored".
119
119
120
-
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:
120
+
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 Jupiter tests for you:
By enabling JUnit 5 for instrumentation tests, you will gain access to `ActivityScenarioExtension` (among other things), which helps with the orchestration of `Activity` classes. Check [the wiki][wiki-home] for more info.
142
+
By enabling JUnit Jupiter for instrumentation tests, you will gain access to `ActivityScenarioExtension` (among other things), which helps with the orchestration of `Activity` classes. Check [the wiki][wiki-home] for more info.
143
143
144
144
### Extensions
145
145
@@ -172,9 +172,9 @@ Can you think of more? Let's discuss in the issues section!
172
172
173
173
### Jetpack Compose
174
174
175
-
To test `@Composable` functions on device with JUnit 5, first enable support for instrumentation tests as described above.
175
+
To test `@Composable` functions on device with JUnit Jupiter, first enable support for instrumentation tests as described above.
176
176
Then, add the Compose test dependency to your `androidTestImplementation` configuration
177
-
and the plugin will autoconfigure JUnit 5 Compose support for you!
177
+
and the plugin will autoconfigure JUnit Jupiter Compose support for you!
178
178
179
179
<detailsopen>
180
180
<summary>Kotlin</summary>
@@ -204,7 +204,7 @@ and the plugin will autoconfigure JUnit 5 Compose support for you!
204
204
```
205
205
</details>
206
206
207
-
[The wiki][wiki-home] includes a section on how to test your Composables with JUnit 5.
207
+
[The wiki][wiki-home] includes a section on how to test your Composables with JUnit Jupiter.
208
208
209
209
### Override the version of instrumentation test libraries
210
210
@@ -233,19 +233,19 @@ when it sets up the artifacts automatically. However, it is possible to choose a
233
233
234
234
## Official Support
235
235
236
-
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:
236
+
At this time, Google hasn't shared any immediate plans to bring first-party support for JUnit Jupiter to Android. The following list is an aggregation of pending feature requests:
-[Add support for JUnit 5 (issuetracker.google.com)](https://issuetracker.google.com/issues/127100532)
240
240
-[JUnit 5 support (github.com/android/android-test)](https://github.com/android/android-test/issues/224)
241
241
242
242
## Support for @Rules
243
243
244
-
Since JUnit 5 has replaced the `@Rule` mechanism with Extensions, the following artifacts help bridge the gap until Android officially transitions to JUnit 5.
244
+
Since JUnit Jupiter has replaced the `@Rule` mechanism with Extensions, the following artifacts help bridge the gap until Android officially transitions to JUnit Jupiter.
245
245
246
246
### InstantExecutorExtension
247
247
248
-
Replaces `InstantTaskExecutorRule` in JUnit 5.
248
+
Replaces `InstantTaskExecutorRule` in JUnit Jupiter.
249
249
250
250
<details>
251
251
<summary>Kotlin</summary>
@@ -274,7 +274,7 @@ For more details see [instant-task-executor-extension](https://github.com/nebosk
274
274
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.
275
275
276
276
-`instrumentation`: The root folder for Android-based modules, namely the instrumentation libraries & a sample application. After cloning, open this project in Android Studio.
277
-
-`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.
277
+
-`plugin`: The root folder for Java-based modules, namely the Gradle plugin for JUnit Jupiter on Android, as well as its test module. After cloning, open this project in IntelliJ IDEA.
278
278
279
279
## Plugin Compatibility Map
280
280
@@ -283,7 +283,7 @@ refer to the table below to find a suitable alternative version. Note that **no
283
283
legacy versions**, so please consider upgrading to at least Android Gradle Plugin 8.2
# <img src=".images/logo.png" align="right" width="100">JUnit Jupiter for Android [][circleci]
2
2
3
-
A Gradle plugin that allows for the execution of [JUnit 5][junit5gh] tests in Android environments using **Android Gradle Plugin ${constants.minimumRequiredAgpVersion} or later.**
3
+
A Gradle plugin that allows for the execution of [JUnit Jupiter][junitgh] tests in Android environments using **Android Gradle Plugin ${constants.minimumRequiredAgpVersion} or later.**
4
4
5
5
## How?
6
6
7
-
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] and facilitates the usage of JUnit 5 for instrumentation tests.
7
+
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] and facilitates the usage of JUnit Jupiter for instrumentation tests.
8
8
9
-
Instructions on how to write tests with the JUnit 5 framework can be found [in their User Guide][junit5ug]. To get a first look at its features, a small showcase project can be found [here][sampletests].
9
+
Instructions on how to write tests with the JUnit framework can be found [in their User Guide][junitug]. To get a first look at its features, a small showcase project can be found [here][sampletests].
10
10
11
11
## Setup
12
12
@@ -110,9 +110,9 @@ The latest version of this plugin requires:
110
110
111
111
## Instrumentation Test Support
112
112
113
-
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".
113
+
You can use JUnit Jupiter to run instrumentation tests on emulators and physical devices, too. Because the framework is built on Java 17 from the ground up, these instrumentation tests will only run on devices running Android 15 (API 35) or newer – older phones will skip the execution of these tests completely, marking them as "ignored".
114
114
115
-
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:
115
+
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 Jupiter tests for you:
116
116
117
117
<details open>
118
118
<summary>Kotlin</summary>
@@ -134,7 +134,7 @@ Before you can write instrumentation tests with JUnit Jupiter, make sure that yo
134
134
```
135
135
</details>
136
136
137
-
By enabling JUnit 5 for instrumentation tests, you will gain access to `ActivityScenarioExtension` (among other things), which helps with the orchestration of `Activity` classes. Check [the wiki][wiki-home] for more info.
137
+
By enabling JUnit Jupiter for instrumentation tests, you will gain access to `ActivityScenarioExtension` (among other things), which helps with the orchestration of `Activity` classes. Check [the wiki][wiki-home] for more info.
138
138
139
139
### Extensions
140
140
@@ -167,9 +167,9 @@ Can you think of more? Let's discuss in the issues section!
167
167
168
168
### Jetpack Compose
169
169
170
-
To test `@Composable` functions on device with JUnit 5, first enable support for instrumentation tests as described above.
170
+
To test `@Composable` functions on device with JUnit Jupiter, first enable support for instrumentation tests as described above.
171
171
Then, add the Compose test dependency to your `androidTestImplementation` configuration
172
-
and the plugin will autoconfigure JUnit 5 Compose support for you!
172
+
and the plugin will autoconfigure JUnit Jupiter Compose support for you!
173
173
174
174
<details open>
175
175
<summary>Kotlin</summary>
@@ -199,7 +199,7 @@ and the plugin will autoconfigure JUnit 5 Compose support for you!
199
199
```
200
200
</details>
201
201
202
-
[The wiki][wiki-home] includes a section on how to test your Composables with JUnit 5.
202
+
[The wiki][wiki-home] includes a section on how to test your Composables with JUnit Jupiter.
203
203
204
204
### Override the version of instrumentation test libraries
205
205
@@ -228,19 +228,19 @@ when it sets up the artifacts automatically. However, it is possible to choose a
228
228
229
229
## Official Support
230
230
231
-
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:
231
+
At this time, Google hasn't shared any immediate plans to bring first-party support for JUnit Jupiter to Android. The following list is an aggregation of pending feature requests:
- [Add support for JUnit 5 (issuetracker.google.com)](https://issuetracker.google.com/issues/127100532)
235
235
- [JUnit 5 support (github.com/android/android-test)](https://github.com/android/android-test/issues/224)
236
236
237
237
## Support for @Rules
238
238
239
-
Since JUnit 5 has replaced the `@Rule` mechanism with Extensions, the following artifacts help bridge the gap until Android officially transitions to JUnit 5.
239
+
Since JUnit Jupiter has replaced the `@Rule` mechanism with Extensions, the following artifacts help bridge the gap until Android officially transitions to JUnit Jupiter.
240
240
241
241
### InstantExecutorExtension
242
242
243
-
Replaces `InstantTaskExecutorRule` in JUnit 5.
243
+
Replaces `InstantTaskExecutorRule` in JUnit Jupiter.
244
244
245
245
<details>
246
246
<summary>Kotlin</summary>
@@ -269,7 +269,7 @@ For more details see [instant-task-executor-extension](https://github.com/nebosk
269
269
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.
270
270
271
271
- `instrumentation`: The root folder for Android-based modules, namely the instrumentation libraries & a sample application. After cloning, open this project in Android Studio.
272
-
- `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.
272
+
- `plugin`: The root folder for Java-based modules, namely the Gradle plugin for JUnit Jupiter on Android, as well as its test module. After cloning, open this project in IntelliJ IDEA.
273
273
274
274
## Plugin Compatibility Map
275
275
@@ -278,7 +278,7 @@ refer to the table below to find a suitable alternative version. Note that **no
278
278
legacy versions**, so please consider upgrading to at least Android Gradle Plugin ${constants.minimumRequiredAgpVersion}
0 commit comments