Skip to main content
Version: 2.0.0-alpha01

Write a test

Testify is a subclass of Android's ActivityTestRule. The testing framework launches the activity under test before each test method annotated with @Test and before any method annotated with @Before.

Each screenshot test method must be annotated with the @ScreenshotInstrumentation annotation.

Within your test method, you can configure the Activity as needed and call assertSame() to capture and validate your UI. The framework handles shutting down the activity after the test finishes and all methods annotated with @After are run.

@RunWith(AndroidJUnit4::class)
class MainActivityScreenshotTest {

@get:Rule var rule = ScreenshotRule(MainActivity::class.java)

@ScreenshotInstrumentation
@Test
fun default() {
rule.assertSame()
}
}