swift-test-strategylisted
Install: claude install-skill hmj1026/dhpk
# Swift test strategy
Load references on demand:
- `references/swift-testing-api.md` — `@Test`/`#expect`/`#require`/parameterized/traits.
- `references/xctest-bridging.md` — XCTest coexistence, async, expectations.
- `references/xcuitest.md` — `XCUIApplication`, launch-arg test seams.
- `references/snapshot-testing.md` — swift-snapshot-testing record/verify discipline.
- `references/test-taxonomy.md` — the 3-layer model → directories.
- `references/protocol-di-host-testing.md` — protocol-fake injection that makes file/Keychain/network code run under host `swift test` (no simulator).
---
## Core rules
1. **RED first.** Write the failing test before the implementation for any new
feature or bugfix in business-logic code (services, view models, repositories).
See the tdd-guide agent for the workflow; this module supplies the iOS
conventions.
2. **Swift Testing for unit/integration, XCTest for UI/perf.** New unit and
integration tests use `import Testing` (`@Test`, `#expect`, `#require`). UI
tests use XCTest + `XCUIApplication`; performance uses XCTest `measure`. The
two frameworks coexist in the same project (babylon already has both).
3. **Test async/actor code with `await`.** Mark tests `async throws`; `await`
the service. Use `#require` to unwrap-or-fail before asserting on the value.
4. **Inject fakes, don't touch real PHI stores.** Unit tests substitute protocol
fakes (in-memory Keychain, in-memory Core Data store
`NSInMemoryStoreType`/`/d