# pointfreeco/swift-snapshot-testing

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/pointfreeco-swift-snapshot-testing).**

4,152 stars · 655 forks · Swift · mit

## Links

- GitHub: https://github.com/pointfreeco/swift-snapshot-testing
- Homepage: https://www.pointfree.co/episodes/ep41-a-tour-of-snapshot-testing
- awesome-repositories: https://awesome-repositories.com/repository/pointfreeco-swift-snapshot-testing.md

## Topics

`screenshot-testing` `snapshot-testing` `swift` `testing`

## Description

This is a snapshot testing framework for Swift that records and compares reference images or data representations to detect regressions in application state. It functions as a visual regression testing tool and a data snapshotting library, converting complex types into stable formats to verify internal state and object properties.

The framework utilizes a multi-format snapshot strategy, allowing values to be represented as images, strings, or data blobs. It includes a mechanism for defining custom snapshot strategies to convert specific data types into comparable formats based on custom logic.

The tool covers visual testing through device-agnostic view capture and image rendering across multiple configurations and orientations. It also provides textual state rendering for data consistency verification and supports asynchronous value snapshotting for states that depend on callbacks or background processes.

Failure messages can generate command-line strings to facilitate the use of external diff tools for visualizing differences.

## Tags

### Testing & Quality Assurance

- [Snapshot Testing](https://awesome-repositories.com/f/testing-quality-assurance/regression-testing-suites/snapshot-testing.md) — Records serialized data states to disk and compares them against future executions to detect regressions.
- [Data Snapshotting for Testing](https://awesome-repositories.com/f/testing-quality-assurance/data-snapshotting-for-testing.md) — Provides a system for converting complex data types into stable formats to verify internal state and object properties.
- [Image Rendering for Values](https://awesome-repositories.com/f/testing-quality-assurance/image-rendering-for-values.md) — Converts application values or views into images to automatically verify visual appearance and layout through snapshot comparisons. ([source](https://www.pointfree.co/episodes/ep41-a-tour-of-snapshot-testing))
- [Multi-Format Snapshot Strategies](https://awesome-repositories.com/f/testing-quality-assurance/multi-format-snapshot-strategies.md) — Allows defining custom transformation logic to represent Swift values as images, strings, or data blobs.
- [Visual](https://awesome-repositories.com/f/testing-quality-assurance/rendered-output-validation/reference-comparisons/visual.md) — Detects regressions by comparing a current image or text representation against a stored reference snapshot. ([source](https://www.pointfree.co/episodes/ep38-protocol-oriented-library-design-part-2))
- [Simulator-Driven Rendering Tests](https://awesome-repositories.com/f/testing-quality-assurance/simulator-driven-rendering-tests.md) — Renders user interface components across multiple device configurations and orientations using the active system simulator.
- [Snapshot Strategy Mapping](https://awesome-repositories.com/f/testing-quality-assurance/snapshot-strategy-mapping.md) — Implements a flexible pipeline to transform specific Swift types into stable snapshot formats for regression testing.
- [Snapshot Testing](https://awesome-repositories.com/f/testing-quality-assurance/snapshot-testing.md) — Captures the serialized state of a data structure and compares it against future outputs to detect regressions.
- [Swift UI Snapshot Testing](https://awesome-repositories.com/f/testing-quality-assurance/software-testing/testing-frameworks/test-frameworks/browser-and-ui-testing/swift-ui-snapshot-testing.md) — Verifies the state and appearance of views and controllers across different devices using snapshot representations.
- [Visual Regression Testing](https://awesome-repositories.com/f/testing-quality-assurance/visual-regression-testing.md) — Automates the capture and comparison of screenshots to detect unintended UI changes.
- [Asynchronous Snapshot Resolution](https://awesome-repositories.com/f/testing-quality-assurance/asynchronous-snapshot-resolution.md) — Provides the ability to wait for callbacks or delegate methods to finish before capturing a final state representation.
- [Asynchronous State Snapshots](https://awesome-repositories.com/f/testing-quality-assurance/asynchronous-test-execution/asynchronous-model-testing/asynchronous-state-snapshots.md) — Captures snapshots of values that depend on callbacks or background processes to ensure final states are correct.
- [Device-Agnostic View Capture](https://awesome-repositories.com/f/testing-quality-assurance/device-agnostic-view-capture.md) — Provides a mechanism to render views and controllers across various devices and orientations from a single simulator to verify layout consistency. ([source](https://cdn.jsdelivr.net/gh/pointfreeco/swift-snapshot-testing@main/README.md))
- [Internal State Verification](https://awesome-repositories.com/f/testing-quality-assurance/internal-state-verification.md) — Records reference text or data dumps of complex objects to detect regressions in internal state or business logic.
- [Asynchronous Value Snapshotting](https://awesome-repositories.com/f/testing-quality-assurance/snapshot-testing/asynchronous-value-snapshotting.md) — Captures snapshots of values that require waiting for callbacks or delegate methods to complete. ([source](https://www.pointfree.co/episodes/ep40-async-functional-refactoring))
- [Custom Snapshot Strategies](https://awesome-repositories.com/f/testing-quality-assurance/snapshot-testing/custom-snapshot-strategies.md) — Allows users to define custom logic to convert complex data types into images, strings, or data formats. ([source](https://cdn.jsdelivr.net/gh/pointfreeco/swift-snapshot-testing@main/README.md))
- [Textual State Rendering](https://awesome-repositories.com/f/testing-quality-assurance/textual-state-rendering.md) — Converts a data type into a textual dump to verify the internal state and properties of an object. ([source](https://www.pointfree.co/episodes/ep41-a-tour-of-snapshot-testing))

### Development Tools & Productivity

- [Value Format Transformations](https://awesome-repositories.com/f/development-tools-productivity/data-transformation/value-transformations/strategy/value-format-transformations.md) — Converts complex data types into standard image or text formats for comparison against stored references.

### Programming Languages & Runtimes

- [Snapshot Testing Frameworks](https://awesome-repositories.com/f/programming-languages-runtimes/swift-testing-tools/snapshot-testing-frameworks.md) — Provides a comprehensive library for recording and comparing reference images or text representations to detect regressions.

### Part of an Awesome List

- [Testing Frameworks](https://awesome-repositories.com/f/awesome-lists/devtools/testing-frameworks.md) — Snapshot testing library.
