Airbnb Eli Hart Mar 31, 2020

Better Android Testing at Airbnb (Part 5)

Article Summary

Airbnb automated screenshot testing across thousands of Android screens to catch UI regressions that manual QA kept missing. Here's how they built it.

In Part 2 of their testing series, Airbnb's Android team explains their screenshot testing infrastructure. Built on top of their MvRx mocking system, it automatically detects visual changes, accessibility issues, and memory leaks across every Fragment in their app.

Key Takeaways

Critical Insight

Airbnb's screenshot testing catches UI regressions automatically across all screens with no manual test writing required from product engineers.

Part 3 reveals how they extended this visual diffing approach to test user interactions and event handling code.

About This Article

Problem

Airbnb's RecyclerViews don't render content that's off-screen, which meant normal screenshots couldn't capture entire sections of the UI. The team needed to test all content in their views, including lists that could stretch 40,000 pixels long.

Solution

Eli Hart's team wrote a custom screenshot library that measures activity views manually, forces layout passes, and loops through layout listeners to ensure all views are fully rendered before drawing to Canvas and saving as Bitmap.

Impact

The library can screenshot views up to 40,000 pixels long by reusing bitmaps efficiently and enabling large heap allocation. Retry logic with exponential backoff also reduced flaky network requests to AWS and Happo.