roborazzi  by takahirom

JVM tool for Android screenshot testing with Robolectric

Created 3 years ago
903 stars

Top 40.0% 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)
6
Issues (30d)
9
Star History
16 stars in the last 30 days

Explore Similar Projects

Starred by Andrew Ng Andrew Ng(Founder of DeepLearning.AI; Cofounder of Coursera; Professor at Stanford), Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), and
2 more.

vision-agent by landing-ai

0.1%
5k
Visual AI agent for generating runnable vision code from image/video prompts
Created 2 years ago
Updated 4 weeks ago
Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems") and Gregor Zunic Gregor Zunic(Cofounder of Browser Use).

droidrun by droidrun

0.9%
8k
Framework for controlling Android devices via LLM agents
Created 10 months ago
Updated 5 days ago
Feedback? Help us improve.