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
- Custom library screenshots entire RecyclerViews (up to 40,000 pixels long) not just visible content
- Happo integration blocks PRs until visual diffs are approved by engineers
- Catches padding, RTL layout bugs, styling changes, and library upgrade regressions automatically
- Zero extra work for devs: tests auto-generate from existing Fragment mocks
- Added LeakCanary and accessibility checks to same test runs for free
Airbnb's screenshot testing catches UI regressions automatically across all screens with no manual test writing required from product engineers.
About This Article
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.
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.
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.