Overview
Emerge’s Snapshots product allows mobile teams to confidently ship UI changes in their app and be notified of regressions before they make it to production — without maintaining any extra test suites or code — by re-using the same Previews you write in Xcode and Android Studio for regular feature development.
Getting started
Check out our respective platform guides to start snapshot testing!
Why choose Emerge?
Snapshot testing for mobile is not a new idea, the community has largely settled on the incumbents swift-snapshot-testing for iOS and paparazzi for Android. These libraries work great but are intrusive, have a non-trivial amount of dev cost to maintain, and only solve a piece of the snapshot testing puzzle.
We've built a fully end-to-end snapshot testing system with the developer experience in mind. We'll highlight a few of the main differences.
Snapshot without writing any extra code
Both of the existing libraries mentioned above require writing manual test cases to generate snapshots. In a modern dev workflow, this means you are essentially doubling the amount of preview code you have to write by having to duplicate your regular preview into a test case.
We thought this sounded crazy and instead came up with a way to generate snapshots from your existing previews.
Managed devices
Emerge runs your snapshots on real simulators (iOS) and emulators (Android) for the most accurate snapshot generation. Managing devices in CI is a pain and we handle that for you.
Sharded diffing
Once you start snapshot testing at scale and have thousands of snapshots to diff for every commit, the diffing itself can become time consuming. Emerge automatically shards our snapshot generation and diffing logic to get you faster results.
Automatic storage
Traditional snapshot testing libraries require you to use Git LFS to store the snapshots directly in your Git repository. This is clunky to manage and clutters your pull requests.
Emerge automatically stores all generated snapshots separately from your code and associates it to the given commit SHA.
No manual recording
The aforementioned snapshot testing libraries also require developers to manually record when updating the "golden" set of snapshots. This is very manual, time-consuming, a source of flakes if the developer environment differs at all, and means every developer needs to be trained in how to do so.
Instead of a manual recording process, Emerge treats the base commit for every pull request as the "golden" set to compare against. When you are finished with your pull request and the snapshot changes are approved, simply merge the branch and it will automatically become the new "golden" set.
Why use snapshot testing?
Your app might already have unit, integration, and end-to-end tests. Where do snapshot tests fit in? Will it help me catch more bugs?
Apps are largely visual, and we believe snapshot tests are the highest value tests you can have. Not only are you asserting that something looks visually correct and doesn't unexpectedly change, you are also ensuring the code that produces the UI is correct. Some of this code is purely styling, but often times your snapshot tests will also be testing your business logic.
Take for example an app that fetches a network request, parses some JSON, and then displays a list of items. If you write a preview that instead reads a mock network response from a file and renders the UI, you are actually testing the display logic and the JSON parsing logic. And with Emerge you get this test for free by writing a preview.
Feature development
Preventing regressions is important, but snapshot testing can also speed up feature development to ensure your feature looks good on a variety of devices, orientations, color schemes, and so on. Traditionally this would require a lot of manual testing and tweaks, but with previews it is a very fast feedback loop. If you change a core component in your app, you can quickly see in our UI how it changes across the entire app, significantly speeding up development and testing time.
Updated 4 months ago