<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/screenshot-tests-for-your-compose-previews-with-one-annotation-qagejjsud" -->

---
title: Screenshot tests for your Compose previews, with one...
description: Mugshot is a new Android library and Gradle plugin that turns existing Compose @Preview functions into screenshot tests by adding a single @Mugshot annotation,...
canonical: https://daily.dev/posts/screenshot-tests-for-your-compose-previews-with-one-annotation-qagejjsud
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Screenshot tests for your Compose previews, with one annotation | daily.dev
og:description: Mugshot is a new Android library and Gradle plugin that turns existing Compose @Preview functions into screenshot tests by adding a single @Mugshot annotation,...
og:url: https://daily.dev/posts/screenshot-tests-for-your-compose-previews-with-one-annotation-qagejjsud
og:image: https://api.daily.dev/og/posts/qAGejjsuD.png
og:image:alt: Screenshot tests for your Compose previews, with one annotation
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Screenshot tests for your Compose previews, with one annotation

**[Medium](https://daily.dev/sources/medium_js)** · 8 min read · 2 upvotes · 0 comments

## Summary

Mugshot is a new Android library and Gradle plugin that turns existing Compose @Preview functions into screenshot tests by adding a single @Mugshot annotation, avoiding hand-written test classes. It renders screens on the JVM using layoutlib (no emulator needed), supports Kotlin Multiplatform, and provides annotations for devices, themes, font scales, and locales that multiply into many golden images per preview. Benchmarks against a 30-module, 299-preview project show verification at 58 seconds cold and 6.7 seconds for a single changed module, faster than Paparazzi (89 seconds) and faster/more memory-efficient than Google's Compose Preview Screenshot Testing, which ran out of memory. The post also argues screenshot tests are cheap for AI coding agents to verify UI changes, since a single command reports exactly which screens changed without needing an emulator or full-resolution image inspection.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://medium.com/@traz.developer/screenshot-tests-for-your-compose-previews-with-one-annotation-f0e106c5545a>

## Questions this post answers

### How can I turn Jetpack Compose @Preview functions into screenshot tests without writing test classes?

Adding a single @Mugshot annotation to an existing @Preview function generates a screenshot test automatically via a KSP processor, without any manual test class. Running ./gradlew recordMugshotDebug creates golden images, and ./gradlew verifyMugshotDebug later re-renders and fails on visual changes. Mugshot uses layoutlib to render on the JVM, so no emulator is required.

_daily.dev surfaces tooling like this for developers automating Compose UI regression coverage._

### How does Mugshot's screenshot testing performance compare to Paparazzi and Google's Compose Preview Screenshot Testing?

On a benchmark of 30 modules with 299 previews (7,176 screenshots) run on a 15-core Mac, Mugshot verified everything in 58 seconds cold and 6.7 seconds after a single module edit, while Paparazzi took 89 seconds and Google's Compose Preview Screenshot Testing ran out of memory with default settings. Mugshot renders at a third resolution by default, making verification 27% faster and images 45% smaller.

_developers comparing Compose screenshot testing tools can track benchmarks like this on daily.dev._

### What are the limitations of Mugshot for Compose screenshot testing?

Mugshot renders only a single frame, so it can capture a moment or end state of an animation but not intermediate frames, and it has no accessibility overlays since semantics should be tested separately. The @Preview arguments device, uiMode, fontScale, and locale are ignored in favor of Mugshot's own annotations, and LocalInspectionMode is left unset, so composables like GoogleMap() render production output rather than preview placeholders.

_daily.dev helps developers weigh trade-offs like these before adopting a new testing tool._

## Similar posts on daily.dev

- [Paparazzi vs Compose Screenshot Testing: A Practical Android Guide](https://daily.dev/posts/paparazzi-vs-compose-screenshot-testing-a-practical-android-guide-krybcma4a) · Medium · 0 upvotes · 0 comments
- [Why and how I was creating internal screenshot testing library for Android](https://daily.dev/posts/why-and-how-i-was-creating-internal-screenshot-testing-library-for-android-lay3h2esl) · ProAndroidDev · 2 upvotes · 1 comments
- [3 Tips for Effective Snapshot Testing with Roborazzi](https://daily.dev/posts/3-tips-for-effective-snapshot-testing-with-roborazzi-1lkco7jab) · Atomic Spin · 0 upvotes · 0 comments
- [What's new in the Jetpack Compose April '26 release](https://daily.dev/posts/what-s-new-in-the-jetpack-compose-april-26-release-dsjkgpbni) · Android Developers Blog · 1 upvotes · 0 comments

---

Tags: [#android](https://daily.dev/tags/android), [#kotlin](https://daily.dev/tags/kotlin), [#jetpack-compose](https://daily.dev/tags/jetpack-compose), [#gradle](https://daily.dev/tags/gradle)

[View this post on daily.dev](https://daily.dev/posts/screenshot-tests-for-your-compose-previews-with-one-annotation-qagejjsud)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Screenshot tests for your Compose previews, with one annotation","url":"https://daily.dev/posts/screenshot-tests-for-your-compose-previews-with-one-annotation-qagejjsud","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/screenshot-tests-for-your-compose-previews-with-one-annotation-qagejjsud"},"datePublished":"2026-09-18T17:30:45.159Z","dateModified":"2026-09-18T17:32:23.009Z","description":"Mugshot is a new Android library and Gradle plugin that turns existing Compose @Preview functions into screenshot tests by adding a single @Mugshot annotation,...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/f702799ca60a36623533e7860eef19bb?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/f702799ca60a36623533e7860eef19bb?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Medium","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Medium","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/medium","url":"https://daily.dev/sources/medium_js"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/screenshot-tests-for-your-compose-previews-with-one-annotation-qagejjsud","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"android,kotlin,jetpack-compose,gradle","timeRequired":"PT8M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Medium","item":"https://daily.dev/sources/medium_js"},{"@type":"ListItem","position":3,"name":"Screenshot tests for your Compose previews, with one annotation"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/screenshot-tests-for-your-compose-previews-with-one-annotation-qagejjsud#faq","mainEntity":[{"@type":"Question","name":"How can I turn Jetpack Compose @Preview functions into screenshot tests without writing test classes?","acceptedAnswer":{"@type":"Answer","text":"Adding a single @Mugshot annotation to an existing @Preview function generates a screenshot test automatically via a KSP processor, without any manual test class. Running ./gradlew recordMugshotDebug creates golden images, and ./gradlew verifyMugshotDebug later re-renders and fails on visual changes. Mugshot uses layoutlib to render on the JVM, so no emulator is required. daily.dev surfaces tooling like this for developers automating Compose UI regression coverage."}},{"@type":"Question","name":"How does Mugshot's screenshot testing performance compare to Paparazzi and Google's Compose Preview Screenshot Testing?","acceptedAnswer":{"@type":"Answer","text":"On a benchmark of 30 modules with 299 previews (7,176 screenshots) run on a 15-core Mac, Mugshot verified everything in 58 seconds cold and 6.7 seconds after a single module edit, while Paparazzi took 89 seconds and Google's Compose Preview Screenshot Testing ran out of memory with default settings. Mugshot renders at a third resolution by default, making verification 27% faster and images 45% smaller. developers comparing Compose screenshot testing tools can track benchmarks like this on daily.dev."}},{"@type":"Question","name":"What are the limitations of Mugshot for Compose screenshot testing?","acceptedAnswer":{"@type":"Answer","text":"Mugshot renders only a single frame, so it can capture a moment or end state of an animation but not intermediate frames, and it has no accessibility overlays since semantics should be tested separately. The @Preview arguments device, uiMode, fontScale, and locale are ignored in favor of Mugshot's own annotations, and LocalInspectionMode is left unset, so composables like GoogleMap() render production output rather than preview placeholders. daily.dev helps developers weigh trade-offs like these before adopting a new testing tool."}}]}
```

