Skip to content

Commit 70b22ee

Browse files
committed
Change default unsupported device behavior to "throw exception"
1 parent 31c98ab commit 70b22ee

File tree

4 files changed

+10
-14
lines changed

4 files changed

+10
-14
lines changed

instrumentation/runner/src/main/kotlin/de/mannodermaus/junit5/internal/runners/DummyJUnitFramework.kt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,14 @@ internal class DummyJUnitFramework(
2525

2626
override fun run(notifier: RunNotifier) {
2727
when (behaviorForUnsupportedDevices) {
28-
"skip" -> skipTests(notifier)
2928
"fail" -> failExecution(unsupportedDeviceMessage)
30-
else -> {
31-
Log.w(
32-
LOG_TAG,
29+
"skip" -> skipTests(notifier)
30+
else ->
31+
failExecution(
3332
"Unknown value found for configuration parameter " +
3433
"'${ConfigurationParameters.BEHAVIOR_FOR_UNSUPPORTED_DEVICES}': " +
35-
"$behaviorForUnsupportedDevices. Apply default behavior " +
36-
"and skip tests for this class.",
34+
"$behaviorForUnsupportedDevices"
3735
)
38-
skipTests(notifier)
39-
}
4036
}
4137
}
4238

plugin/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Change Log
77
- Support instrumentation with JUnit 5 and 6 (the plugin will choose the correct runtime accordingly)
88
- Introduce `de.mannodermaus.android-junit-framework` as the new plugin ID
99
- New: Control behavior of test execution on unsupported devices via `instrumentationTests.behaviorForUnsupportedDevices`
10-
- "Skip": Skip tests and mark them as ignored (default and equal to previous behavior)
11-
- "Fail": Throw an exception and fail test execution
10+
- "Fail": Throw an exception and fail test execution (**this is the new default**)
11+
- "Skip": Skip tests and mark them as ignored (**this is the old behavior**)
1212

1313
## 1.14.0.0 (2025-10-10)
1414
- JUnit 5.14.0

plugin/android-junit5/src/main/kotlin/de/mannodermaus/gradle/plugins/junit5/dsl/AndroidJUnitPlatformExtension.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ constructor(project: Project, private val objects: ObjectFactory) : GroovyObject
7575
objects.newInstance(InstrumentationTestOptions::class.java).apply {
7676
enabled.convention(true)
7777
version.convention(Libraries.Instrumentation.version)
78-
behaviorForUnsupportedDevices.convention(UnsupportedDeviceBehavior.Skip)
78+
behaviorForUnsupportedDevices.convention(UnsupportedDeviceBehavior.Fail)
7979
includeExtensions.convention(false)
8080
useConfigurationParameters.convention(true)
8181
}

plugin/android-junit5/src/test/kotlin/de/mannodermaus/gradle/plugins/junit5/plugin/InstrumentationSupportTests.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,21 @@ internal class InstrumentationSupportTests {
8888
val runnerArgs =
8989
project.android.defaultConfig.testInstrumentationRunnerArguments[
9090
"configurationParameters"]
91-
assertThat(runnerArgs).contains("de.mannodermaus.junit.unsupported.behavior=skip")
91+
assertThat(runnerArgs).contains("de.mannodermaus.junit.unsupported.behavior=fail")
9292
}
9393

9494
@Test
9595
fun `can configure the unsupported device behavior via dsl`() {
9696
project.addJUnit(JUnit5, "androidTest")
9797
project.junitPlatform.instrumentationTests.behaviorForUnsupportedDevices.set(
98-
UnsupportedDeviceBehavior.Fail
98+
UnsupportedDeviceBehavior.Skip
9999
)
100100
project.evaluate()
101101

102102
val runnerArgs =
103103
project.android.defaultConfig.testInstrumentationRunnerArguments[
104104
"configurationParameters"]
105-
assertThat(runnerArgs).contains("de.mannodermaus.junit.unsupported.behavior=fail")
105+
assertThat(runnerArgs).contains("de.mannodermaus.junit.unsupported.behavior=skip")
106106
}
107107

108108
@Test

0 commit comments

Comments
 (0)