https://kotlinlang.org logo
#compose
Title
# compose
t

trevjones

12/15/2021, 3:35 PM
Back in the old days I could drop something like this into my custom test runner onStart
Copy code
Espresso.setFailureHandler { error, viewMatcher ->
    val scan = Radiography.scan(viewStateRenderers = DefaultsIncludingPii)
    error.addSuppressed(RuntimeException("\n$scan"))
    error.addSuppressed(RuntimeException(idlingRegistryStatus))
    DefaultFailureHandler(targetContext).handle(error, viewMatcher)
}
Is there a good way to do similar with the compose rule + testing apis?
z

Zach Klippenstein (he/him) [MOD]

12/15/2021, 7:10 PM
Compose testing uses Espresso itself so I would expect this to also work for compose? But I haven’t tried it
t

trevjones

12/16/2021, 12:11 AM
It deff uses idling resources, but can't seem to find a single case of a test failure hitting the error handler. may need to just play with junit listeners and see if logging at that point is early enough marathon hasn't already stopped the tail
2 Views