ComposeUiTestConfig


Defines the configuration requirements for a Compose test environment.

This configuration allows for fine-grained control over the test execution environment, including the coroutine contexts used for composition and test execution, the overall test timeout, and the initial input mode.

Summary

Public constructors

ComposeUiTestConfig(
    effectContext: CoroutineContext,
    runTestContext: CoroutineContext,
    testTimeout: Duration,
    inputMode: InputMode,
    failurePolicy: TestFailurePolicy
)
Cmn
android

Public functions

open operator Boolean
equals(other: Any?)
android
open Int
android

Public properties

CoroutineContext

The CoroutineContext used to run the composition.

Cmn
android
TestFailurePolicy

The TestFailurePolicy used to configure the failure handling pipeline, such as capture modes for diagnostic artifacts (screenshots, UI hierarchy) and custom failure handlers.

Cmn
android
InputMode

The InputMode to be used for the test.

Cmn
android
CoroutineContext

The CoroutineContext used to create the context to run the test block.

Cmn
android
Duration

The Duration within which the test is expected to complete, otherwise a platform specific timeout exception will be thrown.

Cmn
android

Public constructors

ComposeUiTestConfig

ComposeUiTestConfig(
    effectContext: CoroutineContext = EmptyCoroutineContext,
    runTestContext: CoroutineContext = EmptyCoroutineContext,
    testTimeout: Duration = 60.seconds,
    inputMode: InputMode = InputMode.Touch,
    failurePolicy: TestFailurePolicy = TestFailurePolicy()
)

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

Public properties

effectContext

val effectContextCoroutineContext

The CoroutineContext used to run the composition. The context for LaunchedEffects and rememberCoroutineScope will be derived from this context. If this context contains a TestDispatcher or TestCoroutineScheduler (in that order), it will be used for composition and the androidx.compose.ui.test.MainTestClock. Defaults to EmptyCoroutineContext.

failurePolicy

val failurePolicyTestFailurePolicy

The TestFailurePolicy used to configure the failure handling pipeline, such as capture modes for diagnostic artifacts (screenshots, UI hierarchy) and custom failure handlers. Defaults to TestFailurePolicy.

inputMode

val inputModeInputMode

The InputMode to be used for the test. This determines how input events (such as touch or keyboard) are injected and handled during the test execution. Defaults to InputMode.Touch.

runTestContext

val runTestContextCoroutineContext

The CoroutineContext used to create the context to run the test block. By default, test block will run using kotlinx.coroutines.test.StandardTestDispatcher. runTestContext and effectContext must not share TestCoroutineScheduler. Defaults to EmptyCoroutineContext.

testTimeout

val testTimeoutDuration

The Duration within which the test is expected to complete, otherwise a platform specific timeout exception will be thrown. Defaults to 60 seconds.