File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
android-junit5/src/main/kotlin/de/mannodermaus/gradle/plugins/junit5
instrumentation-runner/src/main/kotlin/de/mannodermaus/junit5 Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,10 @@ class JUnit5DependencyHandler(
9999 return listOf (
100100 versions.others.instrumentationTest,
101101
102- // Required at runtime
102+ // Provided to instrumentation-runner at runtime,
103+ // very important for the execution of JUnit 5 instrumentation tests.
104+ // Also refer to AndroidJUnit5Builder's documentation for
105+ // more info on how this is pieced together.
103106 versions.platform.runner
104107 )
105108 }
Original file line number Diff line number Diff line change @@ -33,7 +33,22 @@ class AndroidJUnit5Builder : RunnerBuilder() {
3333
3434 private val junit5Available by lazy {
3535 try {
36+ // The verification order of this block is quite important.
37+ // Do not change it without thorough testing of potential consequences!
38+ // After tampering with this, verify that integration
39+ // with applications using JUnit 5 for UI tests still works,
40+ // AND that integration with applications NOT using JUnit 5 for UI tests still works.
41+ //
42+ // First, verify the existence of junit-jupiter-api on the classpath.
43+ // Then, verify that the JUnitPlatform Runner is available on the classpath.
44+ // It is VERY important to perform this check BEFORE verifying the existence
45+ // of the AndroidJUnit5 Runner, which inherits from JUnitPlatform. If this is omitted,
46+ // an uncatchable verification error will be raised, rendering instrumentation testing
47+ // for applications without the desire to include JUnit 5 effectively useless.
48+ // The simple Class.forName() check however will catch this allowed inconsistency,
49+ // and gracefully abort.
3650 Class .forName(" org.junit.jupiter.api.Test" )
51+ Class .forName(" org.junit.platform.runner.JUnitPlatform" )
3752 Class .forName(" de.mannodermaus.junit5.AndroidJUnit5" )
3853 true
3954 } catch (e: Throwable ) {
You can’t perform that action at this time.
0 commit comments