roborazzi  by takahirom

JVM tool for Android screenshot testing with Robolectric

created 2 years ago
840 stars

Top 43.4% on sourcepulse

GitHubView on GitHub
Project Summary

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

  • Install: Apply the io.github.takahirom.roborazzi Gradle plugin.
  • Prerequisites: Robolectric 4.10 alpha 1 or later, @GraphicsMode(GraphicsMode.Mode.NATIVE) annotation on test classes.
  • Usage: Execute Gradle tasks like ./gradlew recordRoborazziDebug to capture screenshots and ./gradlew verifyRoborazziDebug to validate them.
  • Docs: https://github.com/takahirom/roborazzi

Highlighted Details

  • Supports capturing screenshots for Espresso onView, Jetpack Compose onNode, raw Views, and Composable lambdas.
  • Offers experimental features like AI-powered image assertion using Gemini or OpenAI, and Compose Preview scanning for automatic test generation.
  • Provides multiplatform support for Compose Multiplatform iOS and Compose Desktop.
  • Includes an IntelliJ IDEA and Android Studio plugin for enhanced IDE integration.

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.

Health Check
Last commit

5 days ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
2
Star History
32 stars in the last 90 days

Explore Similar Projects

Starred by Tobi Lutke Tobi Lutke(Cofounder of Shopify), Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), and
2 more.

screenshot-to-code by abi

0.1%
71k
Screenshot-to-code tool for generating code from visual inputs
created 1 year ago
updated 1 week ago
Feedback? Help us improve.