Write, review, or migrate Swift unit tests using Swift Testing, while preserving XCTest/XCUITest where their APIs are still required. Use for test design, async behavior, traits, parameterization, migration boundaries, and version-gated testing APIs.
87%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Write deterministic tests around observable behavior and keep the framework choice proportional to the target and API under test.
This skill owns Swift Testing syntax, suite organization, traits, parameterization, async tests, known issues, attachments, exit tests, and XCTest migration boundaries. Route UI implementation to UI skills and concurrency design—not merely async test syntax—to swift-concurrency.
Inspect the Xcode/Swift toolchain, target platform, test target type, current framework, and CI invocation before recommending APIs. Preserve a mixed XCTest/Swift Testing suite when migration offers no concrete benefit. Verify versioned test APIs against Swift Evolution, release notes, SDK interfaces, or primary documentation.
| Need | Prefer |
|---|---|
| New unit or integration tests in a supported Swift target | Swift Testing |
| Existing XCTest suite with no migration pressure | Keep XCTest and migrate incrementally |
| UI automation | XCUITest/XCTest |
| XCTest performance measurement APIs | XCTest |
| Objective-C exception testing or tooling that requires XCTestCase | XCTest |
| Common snapshot frameworks tied to XCTest | Keep the supported XCTest integration |
Do not turn migration into an all-or-nothing rewrite.
@Test and @Suite to express behavior and organization.#expect for independent checks and try #require when later assertions depend on an unwrapped or validated value.Read Testing Patterns for suite organization, traits, confirmation, mocks, parameterization, execution behavior, and migration examples.
Prefer deterministic signals, injected clocks, and confirmation over sleeps or polling. Test error, cancellation, and cleanup paths explicitly when production behavior supports them. Keep UI-bound test code on @MainActor; do not annotate an entire test suite merely to silence unrelated isolation errors.
Use protocol- or closure-based dependencies when they provide a real seam. Avoid mocks that reproduce implementation details instead of controlling observable inputs and outputs.
Attachments, warning severity, test cancellation, and exit-test capture behavior vary by toolchain and platform. Read Advanced Testing and state the exact gate beside any correction.
Exit testing is not available on every Apple runtime target. For an iOS app target, isolate fatal-path logic into a testable non-exiting unit or use a supported host/tool target rather than claiming an unavailable API works on-device.
Map behavior, not assertion spelling:
XCTAssert* usually maps to #expectXCTUnwrap maps to try #requireconfirmationsetUp/tearDown state usually becomes suite initialization and scoped cleanupKeep XCTest cases that rely on APIs without a Swift Testing equivalent. Run both frameworks in the same test plan during incremental migration.
XCTestExpectation) inside @Test functions instead of async/await or confirmation.await asynchronous assertions or tasks, resulting in prematurely passing tests.@Test(arguments:) parameterization.Task.sleep durations instead of deterministic test clocks or async notifications.#require; independent checks use #expectthienqo/ios-skills
6bf8b62
Also appears in
since Sep 6, 2026
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.