LithoTestRule
This test utility allows clients to create a TestLithoView instance that allows to test assertion on the view hierarchy rendered by a Litho components.
@RunWith(AndroidJUnit4::class)
class LithoSampleTest {
@Rule @JvmField val LithoTestRule = LithoTestRule()
@Test
fun test() {
val testLithoView = LithoTestRule.render { TestComponent() }
// or you can use setRoot/measure/layout for more fine-grained control
val testLithoView = LithoTestRule.createTestLithoView().attachToWindow().setRoot(TestComponent()).measure().layout()
// Test your assertions on the TestLithoView instance.
}
}Constructors
Properties
Renders into a real Activity window instead of the synthetic one, so that framework behavior only reachable from a real window is exercised. See TestLithoView.attachToWindow.
Functions
Perform any interactions defined in the InteractionScope or on the LithoTestRule.
Creates a LithoView configured for screenshot capture.
Creates new TestLithoView holder responsible for keeping an instance of LithoView, allowing to find Views/Components or perform assertions on it. For simple Component rendering without fine-grained control, use render
Sets the new root to render.
Sets a new TreeProp for the next layout pass.
Creates a ComponentTree that will propagate exceptions.