swift-testing-baselinelisted
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