
Screenshot Testing in Compose - Roborazzi and Visual Regression (v2)
Screenshot testing catches visual regressions before release. Learn to implement Roborazzi and integrate visual testing into your CI pipeline. Setting Up Roborazzi Add Roborazzi dependency and configure screenshot testing: // build.gradle.kts plugins { id ( "io.github.takahirom.roborazzi" ) version "1.x.x" } dependencies { testImplementation ( "io.github.takahirom.roborazzi:roborazzi:1.x.x" ) testImplementation ( "io.github.takahirom.roborazzi:roborazzi-compose:1.x.x" ) } Writing Screenshot Tests Capture composable screenshots automatically: @RunWith ( RoborazziParameterizedTestRunner :: class ) class ButtonScreenshotTest { @ get : Rule val composeTestRule = createComposeRule () @Test fun buttonVariants () { composeTestRule . setContent { Column { Button ( onClick = {}) { Text ( "Primary" ) } OutlinedButton ( onClick = {}) { Text ( "Outlined" ) } TextButton ( onClick = {}) { Text ( "Text" ) } } } composeTestRule . onRoot () . captureRoboImage ( "buttons/variants.png" ) } } Visual Regre
Continue reading on Dev.to Tutorial
Opens in a new tab


