Google은 흑인 공동체를 위한 인종 간 평등을 진전시키기 위해 노력하고 있습니다. Google에서 어떤 노력을 하고 있는지 확인하세요.

ComposeTestRule

interface ComposeTestRule : TestRule
androidx.ui.test.ComposeTestRule

Enables to run tests of individual composables without having to do manual setup. For Android tests see createAndroidComposeRule. Normally this rule is obtained by using createComposeRule factory that provides proper implementation (depending if running host side or Android side).

However if you really need Android specific dependencies and don't want your test to be abstract you can still create createAndroidComposeRule directly and access its underlying Activity.

Summary

Public methods
abstract ComposeTestCaseSetup

Takes the given test case and prepares it for execution-controlled test via ComposeTestCaseSetup.

abstract Unit
setContent(composable: () -> Unit)

Sets the given composable as a content of the current screen.

Properties
abstract AnimationClockTestRule

A test rule that allows you to control the animation clock

abstract Density

Current device screen's density.

abstract DisplayMetrics

Public methods

forGivenTestCase

abstract fun forGivenTestCase(testCase: ComposeTestCase): ComposeTestCaseSetup

Takes the given test case and prepares it for execution-controlled test via ComposeTestCaseSetup.

setContent

abstract fun setContent(composable: () -> Unit): Unit

Sets the given composable as a content of the current screen.

Use this in your tests to setup the UI content to be tested. This should be called exactly once per test.

Exceptions
IllegalStateException if called more than once per test.

Properties

clockTestRule

abstract val clockTestRule: AnimationClockTestRule

A test rule that allows you to control the animation clock

density

abstract val density: Density

Current device screen's density.

displayMetrics

abstract val displayMetrics: DisplayMetrics