BooksEarly access

Mastering Android Screenshot Testing

Release with confidence: eliminate visual regressions across devices and configurations.

50% written · Updated

PDF & EPUB · DRM-free · Free updates · 60-day money-back guarantee

Cover of Mastering Android Screenshot Testing by Alex Zhukovich

Why screenshot testing?

UI tests miss visual bugs

UI tests verify behavior but can't catch visual issues like misaligned layouts, unreadable text colors, or components in the wrong place.

Manual testing doesn't scale

Checking every combination of devices, themes, font sizes, and locales by hand becomes impossible as your app grows.

Refactor with confidence

Catch unintended visual changes when you update libraries or restructure code, so every UI change remains intentional.

What you'll learn

  • Screenshot testing fundamentals

    Understand the core principles and when to use screenshot tests in your Android projects.

  • Tools and framework selection

    Choose a screenshot testing framework and set standards that scale across your team.

  • Component and screen testing

    Write robust tests for Compose components and screens, including dynamic content and animations.

  • Testing across configurations

    Automatically test across themes, orientations, font sizes, locales, and device form factors.

  • CI/CD integration

    Run screenshot tests in your pipeline and catch visual regressions before release.

  • Best practices

    Learn the do's and don'ts that keep a test suite robust and free of flaky tests.

About the book

Testing an Android app means more than checking that it works. Its design needs to hold up on phones, foldables, and tablets, in light and dark mode, at different font sizes and in different languages, with a clean layout and legible text everywhere.

This book introduces screenshot testing (also called visual or snapshot testing): an automated approach that records a reference image of the expected design, then compares each test run against it to detect visual changes. It’s a natural complement to functional UI tests, which verify behavior but not appearance.

Rather than focusing on specific tools that quickly become outdated, the book teaches the principles that apply to every framework. It works through the questions developers actually face: when to use screenshot tests and when not to, what to verify, which frameworks and tools fit your workflow, how to generate tests from preview functions in Jetpack Compose, how to run tests in a CI/CD pipeline, and how to optimize the whole process. By the end, you’ll be able to pick the framework that suits your project and build a safety net that catches visual bugs before release.

Every concept is demonstrated with a demo mood tracker app, and all of the code is available online.

What's inside

Part 1

Introduction to Screenshot Testing

  1. Mobile Testing Fundamentals

    Challenges in Mobile Testing · Types of Mobile Testing

  2. Introduction to Screenshot Testing

    Understanding Screenshot Testing · Use Cases · When Not to Use Screenshot Testing · Impact on the Development Process

Part 2

Preparation for Screenshot Testing Automation

  1. Establishing Standards and Guidelines for Screenshot Testing

  2. Selecting Frameworks and Tools for Screenshot Testing

    Screenshot Testing Frameworks · Screenshot Testing Tools and Services · Making the Right Choice for Your Project

  3. Choosing Between Emulators and Physical Devices for Testing

    When to Choose Emulators · When to Choose Physical Devices

  4. Defining the Scope of Screenshot Testing

    Setting Realistic Expectations · What to Verify with Screenshot Tests

Part 3

Implementing Screenshot Testing

  1. Writing and Executing First Screenshot Tests

    Prioritizing Test Scenarios · Designing Test Cases · Creating First Screenshot Tests

  2. Handling Asynchronous Images

    Providing Fake Images Using the coil-test Library · Using Inspection Mode to Display Fake Images · Choosing the Right Strategy for Your Framework

  3. Generating Screenshot Tests for Preview Functions

    Generating Screenshot Tests from Previews Using ComposablePreviewScanner and Roborazzi

  4. Testing Screens in the Application

    Testing Different States of the Screen · Interaction with the UI Before Capturing a Screenshot · Handling Delays

Appendices

  1. Reference Guide for Local and Instrumentation Tests

  2. Reference Guide for Non-functional Testing Types

Coming next

Added chapter by chapter, free for every reader.

  • Testing components and screens against configurations
  • Parameterized testing
  • Screenshot storage strategies
  • CI/CD integration
  • AI tools
  • Compose Multiplatform

About the author

Alex Zhukovich is a mobile engineer with over a decade of experience building Android apps and automating their UI tests. He has set up screenshot testing for multiple organizations, catching thousands of visual bugs before release, and has spoken about testing at more than 20 conferences. His work ranges from small tools to products used by millions of people.

More about me →

Questions

Do I need experience with screenshot testing?

No. The book starts with the fundamentals and builds up to advanced techniques.

Which frameworks does it cover?

It compares six open-source frameworks, Android Testify, Compose Preview Screenshot Testing, Dropshots, Paparazzi, Roborazzi, and Shot, with hands-on examples in each, and helps you choose between them. It also shows how to generate tests from Compose previews with ComposablePreviewScanner and Roborazzi.

Is there a print version?

Not yet. The book is available as PDF and EPUB while it's being written, and a print edition is planned once it's finished.

Get the book

Pay what you want, from $14.99 (suggested $19.99). You get everything published so far, and every new chapter as it's released.

PDF & EPUB · DRM-free · Free updates · 60-day money-back guarantee