← ClaudeAtlas

swift-testing-baselinelisted

Default test stack for new Apple-platform Swift projects — Swift Testing (`@Test` / `#expect`, no XCTest), pointfreeco/swift-snapshot-testing with baselines in git, CI policy for fakes (no live CKContainer / GKLocalPlayer / network in tests). Use when creating the first test target, choosing a snapshot framework or precision policy, deciding whether CI may touch iCloud / Game Center, when a SwiftPM test run hangs on a live CKContainer / GKLocalPlayer, when `swift build` passes but `swift test` fails to compile, or when asked "XCTest or Swift Testing". Owns the stack decision and CI isolation; Swift Testing syntax and migration → apple-skills:swift-testing.
wei18/apple-dev-skills · ★ 18 · Testing & QA · score 78
Install: claude install-skill wei18/apple-dev-skills
# Swift Testing Baseline ## When to invoke - Starting a new project and choosing a test framework. - Writing the first test target / first `@Test` case. - Introducing CloudKit / GameKit / any network service and deciding whether to run integration tests on CI. - Setting up SwiftUI snapshot testing. - User asks "XCTest or swift-testing", "how do I do snapshots", "should CI connect to iCloud". ## Default decisions ### Framework - **`swift-testing`** (Apple's official framework) for unit / integration tests; **do not use XCTest at all**. - With no legacy code, the switch is zero-cost; swift-testing pairs well with Swift 6 / async. - Name files by the type under test (`<Type>Tests.swift`) and group related cases with `@Suite`. ### Snapshot testing - **`pointfreeco/swift-snapshot-testing`** (`// swift-snapshot-testing >= 1.17` for its swift-testing-compatible `assertSnapshot`). - **Snapshot images go into git** (default `__Snapshots__/` next to the test file) so visual diffs show up in PR review. - Start by covering **the main screens** and expand from there. Each snapshot should cover multiple locales, iPhone / Mac, light / dark, and typical states. #### Snapshot gate strategy — strict content / tolerant board (a settled design decision, not a global knob) Tolerance is **per-suite by view type**, not a global knob: | View class | Strategy | Precision | Why | Re-record rule | |---|---|---|---|---| | Text-heavy content views (screens dominated by text, cards, badges) | De