@@ -29,16 +29,13 @@ To get a first look at its features, a small showcase project can be found [here
2929To get started, declare the plugin in your ` app ` module's build script alongside the latest version.
3030Snapshots of the development version are available through [ Sonatype's ` snapshots ` repository] [ sonatyperepo ] .
3131
32- <details open >
33- <summary >Kotlin</summary >
34-
35- ``` kotlin
36- plugins {
32+ ``` kotlin
33+ plugins {
3734 // 1. Apply the plugin
3835 id(" de.mannodermaus.android-junit5" ) version " 1.14.0.0"
39- }
36+ }
4037
41- dependencies {
38+ dependencies {
4239 // 2. Add JUnit Framework BOM and the required dependencies
4340 testImplementation(platform(" org.junit:junit-bom:5.14.1" ))
4441 testImplementation(" org.junit.jupiter:junit-jupiter-api" )
@@ -48,34 +45,8 @@ Snapshots of the development version are available through [Sonatype's `snapshot
4845 // 3. Add JUnit Vintage if you also have JUnit 4 tests (e.g. Robolectric)
4946 testImplementation(" junit:junit:4.13.2" )
5047 testRuntimeOnly(" org.junit.vintage:junit-vintage-engine" )
51- }
52- ```
53- </details >
54-
55- <details >
56- <summary >Groovy</summary >
57-
58- ``` groovy
59- plugins {
60- // 1. Apply the plugin
61- id "de.mannodermaus.android-junit5" version "1.14.0.0"
62- }
63-
64- dependencies {
65- // 2. Add JUnit Framework BOM and the required dependencies
66- testImplementation platform("org.junit:junit-bom:5.14.1")
67- testImplementation "org.junit.jupiter:junit-jupiter-api"
68- testImplementation "org.junit.jupiter:junit-jupiter-params"
69- testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
70-
71- // 3. Add JUnit Vintage if you also have JUnit 4 tests (e.g. Robolectric)
72- testImplementation "junit:junit:4.13.2"
73- testRuntimeOnly "org.junit.vintage:junit-vintage-engine"
74- }
75- ```
76- </details >
77-
78- <br />
48+ }
49+ ```
7950
8051More information on Getting Started can be found [ on the wiki] [ wiki-gettingstarted ] .
8152
@@ -100,27 +71,12 @@ make sure that your module is using the `androidx.test.runner.AndroidJUnitRunner
10071to the ` androidTestImplementation ` configuration in your build script and the plugin will
10172automatically configure JUnit 5 tests for you:
10273
103- <details open >
104- <summary >Kotlin</summary >
105-
106- ``` kotlin
107- dependencies {
74+ ``` kotlin
75+ dependencies {
10876 androidTestImplementation(platform(" org.junit:junit-bom:5.14.1" ))
10977 androidTestImplementation(" org.junit.jupiter:junit-jupiter-api" )
110- }
111- ```
112- </details >
113-
114- <details >
115- <summary >Groovy</summary >
116-
117- ``` groovy
118- dependencies {
119- androidTestImplementation platform("org.junit:junit-bom:5.14.1")
120- androidTestImplementation "org.junit.jupiter:junit-jupiter-api"
121- }
122- ```
123- </details >
78+ }
79+ ```
12480
12581By enabling JUnit Framework for instrumentation tests, you will gain access to ` ActivityScenarioExtension ` among other things,
12682which helps with the orchestration of ` Activity ` classes. Check [ the wiki] [ wiki-home ] for more info.
@@ -133,63 +89,29 @@ An optional artifact with `extensions` is available for specific use cases. It c
13389
13490Can you think of more? Let's discuss in the issues section!
13591
136- <details open >
137- <summary >Kotlin</summary >
138-
139- ``` kotlin
140- junitPlatform {
141- instrumentationTests.includeExtensions.set(true )
142- }
143- ```
144- </details >
145-
146- <details >
147- <summary >Groovy</summary >
148-
149- ``` groovy
150- junitPlatform {
92+ ``` kotlin
93+ junitPlatform {
15194 instrumentationTests.includeExtensions.set(true )
152- }
153- ```
154- </details >
95+ }
96+ ```
15597
15698### Jetpack Compose
15799
158100To test ` @Composable ` functions on devices compatible with the JUnit Framework,
159101enable support for instrumentation tests as described above. Then add the Compose test dependency
160102to your ` androidTestImplementation ` configuration and the plugin will autoconfigure JUnit 5 Compose support for you.
161103
162- <details open >
163- <summary >Kotlin</summary >
164-
165- ``` kotlin
166- dependencies {
104+ ``` kotlin
105+ dependencies {
167106 // Setup from the previous section for enabling instrumentation tests...
168107
169108 // Compose test framework
170109 androidTestImplementation(" androidx.compose.ui:ui-test-android:$compose_version " )
171110
172111 // Needed for createComposeExtension() and createAndroidComposeExtension()
173112 debugImplementation(" androidx.compose.ui:ui-test-manifest:$compose_version " )
174- }
175- ```
176- </details >
177-
178- <details >
179- <summary >Groovy</summary >
180-
181- ``` groovy
182- dependencies {
183- // Setup from the previous section for enabling instrumentation tests...
184-
185- // Compose test framework
186- androidTestImplementation "androidx.compose.ui:ui-test-android:$compose_version"
187-
188- // Needed for createComposeExtension() and createAndroidComposeExtension()
189- debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
190- }
191- ```
192- </details >
113+ }
114+ ```
193115
194116[ The wiki] [ wiki-home ] includes a section on how to test your Composables.
195117
@@ -198,25 +120,9 @@ to your `androidTestImplementation` configuration and the plugin will autoconfig
198120By default, the plugin will make sure to use a compatible version of the instrumentation test libraries
199121when it sets up the artifacts automatically. However, it is possible to choose a custom version instead via its DSL:
200122
201- <details open >
202- <summary >Kotlin</summary >
203-
204- ``` kotlin
205- junitPlatform {
206- instrumentationTests.version.set(" 1.9.0" )
207- }
208- ```
209- </details >
210-
211- <details >
212- <summary >Groovy</summary >
213-
214- ``` groovy
215- junitPlatform {
123+ junitPlatform {
216124 instrumentationTests.version.set("1.9.0")
217- }
218- ```
219- </details >
125+ }
220126
221127## Official Support
222128
@@ -236,25 +142,11 @@ the following artifacts help bridge the gap until Android officially transitions
236142
237143Replaces ` InstantTaskExecutorRule ` in JUnit 5.
238144
239- <details >
240- <summary >Kotlin</summary >
241-
242- ``` kotlin
243- dependencies {
145+ ``` kotlin
146+ dependencies {
244147 testImplementation(" io.github.neboskreb:instant-task-executor-extension:1.0.0" )
245- }
246- ```
247- </details >
248-
249- <details >
250- <summary >Groovy</summary >
251-
252- ``` groovy
253- dependencies {
254- testImplementation 'io.github.neboskreb:instant-task-executor-extension:1.0.0'
255- }
256- ```
257- </details >
148+ }
149+ ```
258150
259151For more details see [ instant-task-executor-extension] ( https://github.com/neboskreb/instant-task-executor-extension ) on GitHub.
260152
0 commit comments