public interface TestFailureHandler
Handles Compose UI test failures for custom diagnostics or artifact processing.
Implementations are registered in a TestFailurePolicy within a ComposeUiTestConfig and execute in the order provided. If a handler throws an exception, the framework catches and attaches it as a suppressed exception to FailureContext.error, ensuring the original test failure is never masked.
Handlers execute synchronously on the test thread in a post-mortem state where the Compose hierarchy, coroutine scopes, and UI registries have already been torn down. As a result, interactive testing APIs like ComposeUiTest.waitForIdle or onNodeWithTag cannot be called within a handler.
Because handlers execute after the test timeout has elapsed, blocking calls such as file IO or network operations can delay or stall the test runner indefinitely. Handlers that perform heavy IO should enforce their own tight timeouts or dispatch work to background threads.
Functions
onTestFailed
public fun onTestFailed(context: FailureContext)
Invoked synchronously on the test thread when a Compose UI test fails.
Parameters
| context | The FailureContext containing the root Throwable and any generated FailureArtifacts. |