| name | ios-testing-skill |
| description | Skill describing modern iOS testing patterns: Swift Testing vs XCTest, XCUITest best practices, and OS 7.0 expectations for coverage and flakiness.
|
iOS Testing Skill – Swift Testing, XCTest, XCUITest
This skill centralizes iOS testing guidance so that testing agents and gates
can stay lean while following consistent patterns.
It is used by:
ios-testing-specialist
ios-ui-testing-specialist
ios-verification
ios-architect / ios-builder when planning or implementing tests.
Core Concepts
Context7 Libraries
Agents using this skill MAY consult:
Usage Pattern
-
When designing a test strategy:
- Decide which layers to cover (unit/integration/UI),
- Choose Swift Testing vs XCTest based on project/tooling,
- Define critical paths, error cases, and edge cases up front.
-
When implementing tests:
- Keep tests deterministic and fast by default,
- Use tags/traits for slow/critical suites,
- Structure UI tests around page objects and accessibility identifiers.
-
When testing data persistence (SwiftData):
- Always use in-memory ModelContainer in tests
- Test cascade deletes remove dependent data
- Verify unique constraints throw on duplicates
- Test relationship integrity (one-to-many, many-to-one)
- Use @MainActor for async SwiftData tests
-
When testing state management (Atoms):
- Use AtomTestContext to isolate atom behavior
- Override dependency atoms with .override() for mocking
- Test computed atoms recalculate when dependencies change
- Verify StateAtom mutations propagate to watchers
- Test atom cleanup when watchers are removed
-
When acting as a gate (verification/quality):
- Look for coverage of happy paths + failure/edge states,
- Call out flakiness risks (sleep-based waits, environment dependence),
- Recommend incremental improvements, not full rewrites, unless required.
- Verify SwiftData tests use in-memory containers
- Verify Atom tests use AtomTestContext, not real app state
This skill ensures iOS agents talk about testing in a consistent way and know
when to consult context7 for deeper patterns and examples.