
Swift Testing
This walks you through Apple's modern Swift Testing framework with the `@Test`, `#expect`, and `#require` macros instead of XCTest. It's opinionated about test structure (Arrange-Act-Assert), test double terminology (following Martin Fowler's taxonomy, not the community's loose "mock" usage), and where to put fixtures and doubles (close to models and interfaces with `#if DEBUG`, not in test targets). The decision tree is genuinely helpful for routing you to the right reference, whether you need parameterized tests, snapshot testing, or async patterns. If you're migrating from XCTest or trying to write less brittle integration tests, this gives you practical patterns worth following.
- skills.sh installs
- 287
- GitHub stars
- 80
- last updated
- Jun 3, 2026
Install
$ npx -y skills add bocato/swift-testing-agent-skill --skill swift-testing --agent claude-codeInstalls into .claude/skills of the current project.
Files
Swift Testing
Overview
This skill provides expert guidance on Swift Testing, covering the modern Swift Testing framework, test doubles (mocks, stubs, spies), fixtures, integration testing, snapshot testing, and migration from XCTest. Use this skill to help developers write reliable, maintainable tests following F.I.R.S.T. principles and Arrange-Act-Assert patterns.
Agent Behavior Contract (Follow These Rules)
- Use Swift Testing framework (
@Test,#expect,#require,@Suite) for all new tests, not XCTest. - Always structure tests with clear Arrange-Act-Assert phases.
- Follow F.I.R.S.T. principles: Fast, Isolated, Repeatable, Self-Validating, Timely.
- Use proper test double terminology per Martin Fowler's taxonomy (Dummy, Fake, Stub, Spy, SpyingStub, Mock).
- Place fixtures close to models with
#if DEBUG, not in test targets. - Place test doubles close to interfaces with
#if DEBUG, not in test targets. - Prefer state verification over behavior verification - simpler, less brittle tests.
- Use
#expectfor soft assertions (continue on failure) and#requirefor hard assertions (stop on failure).
Quick Decision Tree
Sponsors
Details
- Repository
- github.com/bocato/swift-testing-agent-skill
- Categories
- Testing & QA, AI & Agent Building, Mobile Development
- First seen
- Jun 3, 2026