@@ -24,16 +24,13 @@ To get a first look at its features, a small showcase project can be found [here
2424To get started, declare the plugin in your `app` module's build script alongside the latest version.
2525Snapshots of the development version are available through [Sonatype's `snapshots` repository][sonatyperepo].
2626
27- <details open>
28- <summary>Kotlin</summary>
29-
30- ```kotlin
31- plugins {
27+ ```kotlin
28+ plugins {
3229 // 1. Apply the plugin
3330 id("de.mannodermaus.android-junit5") version "${pluginVersion}"
34- }
31+ }
3532
36- dependencies {
33+ dependencies {
3734 // 2. Add JUnit Framework BOM and the required dependencies
3835 testImplementation(platform("${libs.junit.framework.bom5}"))
3936 testImplementation("${libs.junit.jupiter.api}")
@@ -43,34 +40,8 @@ Snapshots of the development version are available through [Sonatype's `snapshot
4340 // 3. Add JUnit Vintage if you also have JUnit 4 tests (e.g. Robolectric)
4441 testImplementation("${libs.junit.vintage.api}")
4542 testRuntimeOnly("${libs.junit.vintage.engine}")
46- }
47- ```
48- </details>
49-
50- <details>
51- <summary>Groovy</summary>
52-
53- ```groovy
54- plugins {
55- // 1. Apply the plugin
56- id "de.mannodermaus.android-junit5" version "${pluginVersion}"
57- }
58-
59- dependencies {
60- // 2. Add JUnit Framework BOM and the required dependencies
61- testImplementation platform("${libs.junit.framework.bom5}")
62- testImplementation "${libs.junit.jupiter.api}"
63- testImplementation "${libs.junit.jupiter.params}"
64- testRuntimeOnly "${libs.junit.jupiter.engine}"
65-
66- // 3. Add JUnit Vintage if you also have JUnit 4 tests (e.g. Robolectric)
67- testImplementation "${libs.junit.vintage.api}"
68- testRuntimeOnly "${libs.junit.vintage.engine}"
69- }
70- ```
71- </details>
72-
73- <br/>
43+ }
44+ ```
7445
7546More information on Getting Started can be found [on the wiki][wiki-gettingstarted].
7647
@@ -95,27 +66,12 @@ make sure that your module is using the `androidx.test.runner.AndroidJUnitRunner
9566to the `androidTestImplementation` configuration in your build script and the plugin will
9667automatically configure JUnit 5 tests for you:
9768
98- <details open>
99- <summary>Kotlin</summary>
100-
101- ```kotlin
102- dependencies {
69+ ```kotlin
70+ dependencies {
10371 androidTestImplementation(platform("${libs.junit.framework.bom5}"))
10472 androidTestImplementation("${libs.junit.jupiter.api}")
105- }
106- ```
107- </details>
108-
109- <details>
110- <summary>Groovy</summary>
111-
112- ```groovy
113- dependencies {
114- androidTestImplementation platform("${libs.junit.framework.bom5}")
115- androidTestImplementation "${libs.junit.jupiter.api}"
116- }
117- ```
118- </details>
73+ }
74+ ```
11975
12076By enabling JUnit Framework for instrumentation tests, you will gain access to `ActivityScenarioExtension` among other things,
12177which helps with the orchestration of `Activity` classes. Check [the wiki][wiki-home] for more info.
@@ -128,63 +84,29 @@ An optional artifact with `extensions` is available for specific use cases. It c
12884
12985Can you think of more? Let's discuss in the issues section!
13086
131- <details open>
132- <summary>Kotlin</summary>
133-
134- ```kotlin
135- junitPlatform {
136- instrumentationTests.includeExtensions.set(true)
137- }
138- ```
139- </details>
140-
141- <details>
142- <summary>Groovy</summary>
143-
144- ```groovy
145- junitPlatform {
87+ ```kotlin
88+ junitPlatform {
14689 instrumentationTests.includeExtensions.set(true)
147- }
148- ```
149- </details>
90+ }
91+ ```
15092
15193### Jetpack Compose
15294
15395To test `@Composable` functions on devices compatible with the JUnit Framework,
15496enable support for instrumentation tests as described above. Then add the Compose test dependency
15597to your `androidTestImplementation` configuration and the plugin will autoconfigure JUnit 5 Compose support for you.
15698
157- <details open>
158- <summary>Kotlin</summary>
159-
160- ```kotlin
161- dependencies {
99+ ```kotlin
100+ dependencies {
162101 // Setup from the previous section for enabling instrumentation tests...
163102
164103 // Compose test framework
165104 androidTestImplementation("androidx.compose.ui:ui-test-android:$compose_version")
166105
167106 // Needed for createComposeExtension() and createAndroidComposeExtension()
168107 debugImplementation("androidx.compose.ui:ui-test-manifest:$compose_version")
169- }
170- ```
171- </details>
172-
173- <details>
174- <summary>Groovy</summary>
175-
176- ```groovy
177- dependencies {
178- // Setup from the previous section for enabling instrumentation tests...
179-
180- // Compose test framework
181- androidTestImplementation "androidx.compose.ui:ui-test-android:$compose_version"
182-
183- // Needed for createComposeExtension() and createAndroidComposeExtension()
184- debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
185- }
186- ```
187- </details>
108+ }
109+ ```
188110
189111[The wiki][wiki-home] includes a section on how to test your Composables.
190112
@@ -193,25 +115,9 @@ to your `androidTestImplementation` configuration and the plugin will autoconfig
193115By default, the plugin will make sure to use a compatible version of the instrumentation test libraries
194116when it sets up the artifacts automatically. However, it is possible to choose a custom version instead via its DSL:
195117
196- <details open>
197- <summary>Kotlin</summary>
198-
199- ```kotlin
200- junitPlatform {
201- instrumentationTests.version.set("${instrumentationVersion}")
202- }
203- ```
204- </details>
205-
206- <details>
207- <summary>Groovy</summary>
208-
209- ```groovy
210- junitPlatform {
118+ junitPlatform {
211119 instrumentationTests.version.set("${instrumentationVersion}")
212- }
213- ```
214- </details>
120+ }
215121
216122## Official Support
217123
@@ -231,25 +137,11 @@ the following artifacts help bridge the gap until Android officially transitions
231137
232138Replaces `InstantTaskExecutorRule` in JUnit 5.
233139
234- <details>
235- <summary>Kotlin</summary>
236-
237- ```kotlin
238- dependencies {
140+ ```kotlin
141+ dependencies {
239142 testImplementation("${libs.instanttaskexecutor.extension}")
240- }
241- ```
242- </details>
243-
244- <details>
245- <summary>Groovy</summary>
246-
247- ```groovy
248- dependencies {
249- testImplementation '${libs.instanttaskexecutor.extension}'
250- }
251- ```
252- </details>
143+ }
144+ ```
253145
254146For more details see [instant-task-executor-extension](https://github.com/neboskreb/instant-task-executor-extension) on GitHub.
255147
0 commit comments