runEmptyComposeUiTest
Function
Android
@ExperimentalTestApi
fun runEmptyComposeUiTest(block: ComposeUiTest.() -> Unit): TestResult
Variant of runComposeUiTest
that does not launch an Activity to host Compose content in and
thus acts as an "empty shell". Use this if you need to have control over the timing and method of
launching the Activity, for example when you want to launch it with a custom Intent, or if you
have a complex test setup.
When using this method, calling ComposeUiTest.setContent
will throw an IllegalStateException.
Instead, you'll have to set the content in the Activity that you have launched yourself, either
directly on the Activity or on an androidx.compose.ui.platform.AbstractComposeView
. You will
need to do this from within the test lambda
, or the test framework will not be able to
find the content.