# FailureContext

Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/ComposeUiTestConfig.kt+class:androidx.compose.ui.test.FailureContext) Added in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.13.0-rc01) Common/AllAndroid/JVM
- Cmn

  ```
  class FailureContext
  ```

*** ** * ** ***

A contextual object provided to `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/TestFailureHandler`s when a Compose UI test fails.

This context encapsulates the environment of the failure, providing both the root exception that triggered the failure and any diagnostic artifacts (such as screenshots or UI hierarchy dumps) that were captured by the testing framework prior to invoking the custom handlers.

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/FailureContext#FailureContext(kotlin.Throwable,kotlin.collections.List)(error: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html, artifacts: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/test/FailureArtifact>)` | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/test/FailureArtifact>` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/FailureContext#artifacts()` A list of diagnostic `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/FailureArtifact` objects generated by the failure pipeline. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/FailureContext#error()` The original `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html` (e.g., `AssertionError` or timeout exception) that caused the test to fail. | Cmn |

## Public constructors

### FailureContext

Cmn Added in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.13.0-rc01)

```
FailureContext(error: Throwable, artifacts: List<FailureArtifact>)
```

## Public properties

### artifacts

Cmn Added in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.13.0-rc01)

```
val artifacts: List<FailureArtifact>
```

A list of diagnostic `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/FailureArtifact` objects generated by the failure pipeline. Handlers can use this list to locate and process the generated diagnostic files on the host platform.

### error

Cmn Added in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.13.0-rc01)

```
val error: Throwable
```

The original `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html` (e.g., `AssertionError` or timeout exception) that caused the test to fail.