Screenshot Testing in Jetpack Compose with Roborazzi
Screenshot testing ensures UI consistency across releases. Roborazzi is a snapshot testing tool for Jetpack Compose that captures golden images and compares against new renders.
Setup
testImplementation("io.github.takahirom:roborazzi:1.x")
Basic Screenshot Test
@get:Rule
val roborazziRule = RoborazziRule()
@Test
fun captureScreenshot() {
composeTestRule.setContent {
MyScreen()
}
roborazziRule.captureRoboImage()
}
CI/CD Integration
Compare screenshots in GitHub Actions:
- name: Compare Roborazzi
run: ./gradlew verifyRoborazziScreenshots
Roborazzi detects pixel-level changes, preventing accidental UI regressions during refactoring.
8 production-ready Android app templates on Gumroad.
Browse templates → Gumroad
Top comments (0)