A modern Swift testing library
Catch changes your assertions cannot see.
SnapshotTesting compares a value with a stored reference. Test UIKit and SwiftUI screens, JSON, requests, dumps, and the formats that matter to your project.
One assertion, a useful result
Start with the test you already wanted to write.
The first run records a missing reference and tells you where it went. Later runs compare against that file and point to the difference when the value changes.
import SnapshotTesting
import Testing
@MainActor
struct ProfileTests {
@Test func profileCard() {
assertSnapshot(of: ProfileCard(), as: .image)
}
}References that stay readable
See the change. Keep the proof.
Snapshot files live beside tests by default. They are ordinary files, easy to review in a pull request and simple to update when a visual change is intentional.
What it tests
Images
Render UIKit and SwiftUI views at the devices and traits you choose.
Read more →Text formats
Compare JSON, property lists, raw requests, and recursive descriptions.
Read more →SwiftUI previews
Reuse preview definitions in tests with SnapshotPreviews.
Read more →Your own values
Write a snapshot strategy for data that has a stable representation.
Read more →Built for current Swift
Swift 6.3, Apple platforms, Linux, and Android.
Image rendering uses native platform frameworks. Text and data snapshots work wherever Swift does.
A maintained fork
Built on Point-Free's original SnapshotTesting.
This project continues the library created by Point-Free, with Swift 6 support and active maintenance by Modern Swift Development.