Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,16 @@ internal class DeviceRunController(
}
// Move AndroidJUnitRunner filter keys (package, class, annotation, etc.) from extraOptions to testTargets if necessary.
val filterKeys = listOf("package", "notPackage", "class", "notClass", "annotation", "notAnnotation", "size")
val filteredOptions = extraOptions.filter { opt ->
val key = opt.substringBefore('=')
val filteredOptions = mutableMapOf<String, String>()
extraOptions.forEach { opt ->
val key = opt.substringBefore('=').trim()
val value = opt.substringAfter('=').trim()
if (filterKeys.contains(key)) {
val value = opt.substringAfter('=')
value.split(',').forEach { v ->
value.split(',').map { it.trim() }.filter { it.isNotEmpty() }.forEach { v ->
mappedTestTargets.add("$key $v")
}
false
} else {
true
filteredOptions[key] = value
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ internal class DeviceRunControllerTest {
assertThat(testTargets.size).isEqualTo(3)

// Verify non-filter keys remained in extra options along with implicit defaults
val additionalTestOptions = instrumentationTest?.additionalTestOptions ?: emptyList<String>()
val optionsSet = additionalTestOptions as List<*>
assertThat(optionsSet.contains("disable_window_animations=true")).isTrue()
assertThat(optionsSet.contains("firebase.test.lab=true")).isTrue()
assertThat(optionsSet.contains("customKey=customValue")).isTrue()
@Suppress("UNCHECKED_CAST")
val additionalTestOptions = instrumentationTest?.additionalTestOptions as? Map<String, String> ?: emptyMap()
assertThat(additionalTestOptions["disable_window_animations"]).isEqualTo("true")
assertThat(additionalTestOptions["firebase.test.lab"]).isEqualTo("true")
assertThat(additionalTestOptions["customKey"]).isEqualTo("customValue")
assertThat(additionalTestOptions.size).isEqualTo(3)
}

Expand Down
Loading