Skip to content

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.

ProfileTests.swift
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

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.

Read the documentation

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.