Log assertions failures in FlickerService
So that we can still have a place to check the flicker failures when failing metrics are reported but the test doesn't fail with that failure.
Test: atest FlickerLibTest
Bug: 283926392
Change-Id: I174222b90ecc9b6a82d48c0e469104bddbdde7e5
diff --git a/libraries/flicker/src/android/tools/device/flicker/FlickerService.kt b/libraries/flicker/src/android/tools/device/flicker/FlickerService.kt
index 27071c9..9993740 100644
--- a/libraries/flicker/src/android/tools/device/flicker/FlickerService.kt
+++ b/libraries/flicker/src/android/tools/device/flicker/FlickerService.kt
@@ -53,7 +53,7 @@
try {
val scenarioInstances = detectScenarios(reader)
val assertions = generateAssertions(scenarioInstances)
- assertionRunner.execute(assertions)
+ executeAssertions(assertions)
} catch (exception: Throwable) {
CrossPlatform.log.e("$FLICKER_TAG-ASSERT", "FAILED PROCESSING", exception)
throw exception
@@ -79,7 +79,23 @@
assertions: Collection<IFaasAssertion>
): Collection<IAssertionResult> {
return CrossPlatform.log.withTracing("FlickerService#executeAssertions") {
- assertionRunner.execute(assertions)
+ val results = assertionRunner.execute(assertions)
+ logResults(results)
+ results
+ }
+ }
+
+ private fun logResults(results: Collection<IAssertionResult>) {
+ results.forEach {
+ if (it.failed) {
+ CrossPlatform.log.w(
+ "$FLICKER_TAG-SERVICE",
+ "${it.assertion} FAILED :: " +
+ (it.assertionError?.message ?: "<NO ERROR MESSAGE>")
+ )
+ } else {
+ CrossPlatform.log.w("$FLICKER_TAG-SERVICE", "${it.assertion} PASSED")
+ }
}
}
}