@@ -109,27 +109,33 @@ To start writing instrumentation tests with JUnit Jupiter, add the following to
109109 ``` groovy
110110 android {
111111 defaultConfig {
112- // (Required ) Make sure to use the AndroidJUnitRunner, of a subclass of it
113- testInstrumentationRunner "android.support .test.runner.AndroidJUnitRunner"
114- // (Required ) Connect JUnit 5 to the runner
112+ // 1 ) Make sure to use the AndroidJUnitRunner, of a subclass of it
113+ testInstrumentationRunner "androidx .test.runner.AndroidJUnitRunner"
114+ // 2 ) Connect JUnit 5 to the runner
115115 testInstrumentationRunnerArgument "runnerBuilder", "de.mannodermaus.junit5.AndroidJUnit5Builder"
116116 }
117117
118+ // 3) Java 8 is required
118119 compileOptions {
119120 sourceCompatibility JavaVersion.VERSION_1_8
120121 targetCompatibility JavaVersion.VERSION_1_8
121122 }
123+
124+ // 4) JUnit 5 will bundle in files with identical paths; exclude them
125+ packagingOptions {
126+ exclude "META-INF/LICENSE.md"
127+ exclude "META-INF/LICENSE-notice.md"
128+ }
122129 }
123130
124131 dependencies {
125- // (Required) Writing tests for JUnit Jupiter
132+ // 5) Jupiter API & Platform runner
126133 androidTestImplementation "org.junit.jupiter:junit-jupiter-api:5.4.0"
127- // (Required) The instrumentation test companion library
128- androidTestImplementation "de.mannodermaus.junit5:android-instrumentation-test:0.2.2"
129-
130- // (Required) Runtime dependencies to orchestrate the execution on-device
131134 androidTestRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.4.0"
132135 androidTestRuntimeOnly "org.junit.platform:junit-platform-runner:1.4.0"
136+
137+ // 6) The instrumentation test companion libraries
138+ androidTestImplementation "de.mannodermaus.junit5:android-instrumentation-test:0.2.2"
133139 androidTestRuntimeOnly "de.mannodermaus.junit5:android-instrumentation-test-runner:0.2.2"
134140 }
135141 ```
@@ -141,26 +147,32 @@ To start writing instrumentation tests with JUnit Jupiter, add the following to
141147 ``` groovy
142148 android {
143149 defaultConfig {
144- // (Required ) Make sure to use the AndroidJUnitRunner, of a subclass of it
145- testInstrumentationRunner = "android.support .test.runner.AndroidJUnitRunner"
146- // (Required ) Connect JUnit 5 to the runner
150+ // 1 ) Make sure to use the AndroidJUnitRunner, of a subclass of it
151+ testInstrumentationRunner = "androidx .test.runner.AndroidJUnitRunner"
152+ // 2 ) Connect JUnit 5 to the runner
147153 testInstrumentationRunnerArgument("runnerBuilder", "de.mannodermaus.junit5.AndroidJUnit5Builder")
148154 }
149155
156+ // 3) Java 8 is required
150157 compileOptions {
151158 setSourceCompatibility(JavaVersion.VERSION_1_8)
152159 setTargetCompatibility(JavaVersion.VERSION_1_8)
153160 }
161+
162+ // 4) JUnit 5 will bundle in files with identical paths; exclude them
163+ packagingOptions {
164+ exclude("META-INF/LICENSE.md")
165+ exclude("META-INF/LICENSE-notice.md")
166+ }
154167 }
155168 dependencies {
156- // (Required) Writing tests for JUnit Jupiter
169+ // 5) Jupiter API & Platform runner
157170 androidTestImplementation("org.junit.jupiter:junit-jupiter-api:5.4.0")
158- // (Required) The instrumentation test companion library
159- androidTestImplementation("de.mannodermaus.junit5:android-instrumentation-test:0.2.2")
160-
161- // (Required) Runtime dependencies to orchestrate the execution on-device
162171 androidTestRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.4.0")
163172 androidTestRuntimeOnly("org.junit.platform:junit-platform-runner:1.4.0")
173+
174+ // 6) The instrumentation test companion libraries
175+ androidTestImplementation("de.mannodermaus.junit5:android-instrumentation-test:0.2.2")
164176 androidTestRuntimeOnly("de.mannodermaus.junit5:android-instrumentation-test-runner:0.2.2")
165177 }
166178 ```
0 commit comments