Expert guidance for Swift Testing: test structure, #expect/#require macros, traits and tags, parameterized tests, test plans, parallel execution, async waiting patterns, and XCTest migration. Use when writing new Swift tests, modernizing XCTest suites, debugging flaky tests, or improving test quality and maintainability in Apple-platform or Swift server projects.
Use the swift-testing-expert skill and review this test target for migration opportunities and flaky parallel behavior. Start with a concise list of the highest-value findings and suggested next steps; do not modify files. Test target: <path-or-pasted-test-code>.
Required inputs
Path to a Swift test target, or its pasted test code
Xcode/Swift version and platform targets
Whether failures are deterministic or flaky
Any shared databases, files, network resources, or global state used by the tests
Suggested template by Skill Leaderboard, grounded in the linked source. Task evidence ↗
SKILL.md
name: swift-testing-expertdescription: 'Expert guidance for Swift Testing: test structure, #expect/#require macros, traits and tags, parameterized tests, test plans, parallel execution, async waiting patterns, and XCTest migration. Use when writing new Swift tests, modernizing XCTest suites, debugging flaky tests, or improving test quality and maintainability in Apple-platform or Swift server projects.'
Swift Testing
Overview
Use this skill to write, review, migrate, and debug Swift tests with modern Swift Testing APIs. Prioritize readable tests, robust parallel execution, clear diagnostics, and incremental migration from XCTest where needed.
Agent behavior contract (follow these rules)
Prefer Swift Testing for Swift unit and integration tests, but keep XCTest for UI automation (XCUIApplication), performance metrics (XCTMetric), and Objective-C-only test code.
Treat #expect as the default assertion and use #require when subsequent lines depend on a prerequisite value.
Default to parallel-safe guidance. If tests are not isolated, first propose fixing shared state before applying .serialized.
Prefer traits for behavior and metadata (.enabled, .disabled, .timeLimit, .bug, tags) over naming conventions or ad-hoc comments.
Recommend parameterized tests when multiple tests share logic and differ only in input values.
Use @available on test functions for OS-gated behavior instead of runtime #available checks inside test bodies; never annotate suite types with @available.
Keep migration advice incremental: convert assertions first, then organize suites, then introduce parameterization/traits.
Only import Testing in test targets, never in app/library/binary targets.
First 60 seconds (triage template)
Clarify the goal: new tests, migration, flaky failures, performance, CI filtering, or async waiting.
Collect minimal facts:
Xcode/Swift version and platform targets
Whether tests currently use XCTest, Swift Testing, or both
Whether failures are deterministic or flaky
Whether tests access shared resources (database, files, network, global state)
Branch quickly:
repetitive tests -> parameterized tests
noisy or flaky failures -> known issue handling and test isolation
migration questions -> XCTest mapping and coexistence strategy