JVM tool for Android screenshot testing with Robolectric
Top 43.4% on sourcepulse
Roborazzi is a JVM-based screenshot testing library for Android applications, designed to integrate seamlessly with Robolectric. It addresses the challenges of visual regression testing by enabling developers to capture and compare UI screenshots directly within local JVM tests, offering a more stable and efficient alternative to device-based instrumentation tests.
How It Works
Roborazzi leverages Robolectric's Native Graphics (RNG) mode to render Android UI components on the JVM. It integrates with Robolectric, allowing tests to run with dependencies like Hilt and interact with application components. The core functionality involves capturing screenshots of UI elements (Views, Composables, or entire screens) and comparing them against baseline images, flagging any visual discrepancies.
Quick Start & Requirements
io.github.takahirom.roborazzi
Gradle plugin.@GraphicsMode(GraphicsMode.Mode.NATIVE)
annotation on test classes../gradlew recordRoborazziDebug
to capture screenshots and ./gradlew verifyRoborazziDebug
to validate them.Highlighted Details
onView
, Jetpack Compose onNode
, raw Views, and Composable lambdas.Maintenance & Community
The project is actively maintained by takahirom and has contributions from Square, Inc. and the Android Open Source Project. Community support channels are not explicitly mentioned in the README.
Licensing & Compatibility
Licensed under the Apache License, Version 2.0. This license is permissive and generally compatible with commercial and closed-source applications.
Limitations & Caveats
iOS support is experimental, with several features (e.g., Dropbox/Differ comparison, dump mode) not yet implemented due to migration to a multiplatform backend. Inconsistent rendering across different operating systems is a known issue, recommending CI environments for consistent testing.
5 days ago
1 day