Write, review, or migrate Swift unit tests using Swift Testing, with guidance on framework choice, async behavior, traits, parameterization, and incremental migration from XCTest.
Ships in all-ios-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
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 #expectWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/all-ios-skills:swift-testingfrom all-ios-skills
npx claudepluginhub thienqo/ios-skills --plugin all-ios-skills95 skills in this plugin
/accessorysetupkitDiscover and configure Bluetooth and Wi-Fi accessories using AccessorySetupKit. Use when presenting a privacy-preserving accessory picker, defining discovery descriptors for BLE or Wi-Fi devices, handling accessory session events, migrating from CoreBluetooth permission-based scanning, or setting up accessories without requiring broad Bluetooth permissions./activitykitBuild or review Live Activities and Dynamic Island experiences with ActivityKit, including lifecycle, layouts, push updates, and scheduled delivery. Use for time-sensitive Lock Screen or Dynamic Island state; route ordinary widgets to widgetkit./adattributionkitMeasure ad effectiveness with privacy-preserving attribution using AdAttributionKit. Use when registering ad impressions, handling attribution postbacks, updating conversion values, implementing re-engagement attribution, configuring publisher or advertiser apps, or replacing SKAdNetwork with AdAttributionKit for ad measurement.Other plugins' skills for the same job