Agent skill · software engineering · dpearson2699

swift-testing

Writes and migrates Swift Testing framework tests with @Test, @Suite, #expect, #require, confirmation, traits, withKnownIssue, Attachment.record, processExitsWith exit tests and capture lists, Test.cancel, Issue.record warnings/manual failures, XCTest-to-Swift Testing migration, Xcode 27 interoperability modes, XCUITest UI-test boundaries, performance/snapshot boundaries, mocking, async patterns, and test organization. Use when writing tests, converting XCTest assertions such as XCTUnwrap or XCTFail, reviewing advanced Swift Testing API availability, or deciding when to keep XCTest/XCUITest.

Why this skill is useful

Adds specific patterns and commands for migrating from XCTest to Swift Testing that the AI wouldn't reliably generate on its own.

What it needs

About 6k tokens when loaded. Last updated 2026-07-31. 973 stars on the source repository.

What this skill does

Swift Testing Swift Testing is the modern testing framework for Swift (Xcode 16+, Swift 6+). Prefer it for new unit tests. Keep XCTest where migration is still in progress, and use XCTest for UI automation, performance APIs, Objective-C exception tests, and common snapshot-test tooling. Contents Basic Tests @Test Traits #expect and #require @Suite and Test Organization Execution Model XCTest Migration Boundaries Known Issues Additional Patterns Common Mistakes Test Attachments Exit Testing Version-Gated APIs Review Checklist References --- Basic Tests @Test Traits #expect and #require Rule: Use #require when subsequent assertions depend on the value. Use #expect for independent checks. @Suite and Test Organization See references/testing-patterns.md for suite organization, confirmation patterns, known-issue handling, and execution-model details. Execution Model Swift Testing runs tests in parallel by default. Do not assume test order, shared suite instances, or exclusive access to mutable state unless you explicitly design for it. Use .serialized when a test or suite must run one-at-a-time because it touches shared external state. It does not make unrelated tests outside that scope run serially. Rules: Each test must set up its own state. Shared mutable globals are a bug unless protected or intentionally serialized. @Suite(.serialized) is for exclusive execution, not for expressing logical ordering between tests. If tests depend on sequence, combine them into one test or move the sequence into shared helper code. XCTest Migration Boundaries Swift Testing unit tests do not inherit from XCTestCase. Declare @Test on free functions or methods on suite types such as struct, class, or actor; use static or class methods when instance fixtures are unnecessary. XCTest and Swift Testing can coexist during migration. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills dpearson2699/swift-testing

View the source on GitHub

Browse the @skills marketplace