Snapshot tests: when are they useful and how not to drown in false failures?
The gist
A snapshot test renders a component or screen into an image (or a text dump) and compares it with a reference stored in the repository. The first run records the reference, later runs fail on any mismatch and attach a diff. It is a cheap way to catch visual regressions — a shifted margin, text truncated in a long localization, a broken dark theme — that a unit test cannot see and a UI test checks expensively.
The de facto standard is Point-Free's swift-snapshot-testing: .image, .recursiveDescription, .dump strategies, support for UIKit and SwiftUI, XCTest and Swift Testing.
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep