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, 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 Te
Security Assessment
Detected risks:
About swift-testing
The swift-testing skill provides guidance for writing and migrating tests using the Swift Testing framework, the modern testing solution for Swift projects targeting Xcode 16+ and Swift 6+. It helps developers create new unit tests, convert existing XCTest-based tests, and apply Swift Testing best practices. The skill focuses on the framework's recommended patterns and boundaries, helping users understand when to use Swift Testing and when XCTest or XCUITest should still be retained for specialized scenarios such as UI testing, performance benchmarking, or snapshot testing.
Key capabilities include creating tests with @Test, organizing test suites with @Suite, using traits such as tags, disabled tests, conditional execution, bug references, and time limits, and writing assertions with #expect and #require. The skill also covers execution model considerations, including parallel test execution and serialized suites for shared external state. Additional topics referenced in the skill include confirmation patterns, known-issue handling, test attachments, exit testing, mocking approaches, async testing patterns, test organization, issue recording, cancellation handling, and migration guidance from XCTest to Swift Testing.
This skill is intended for Swift developers, QA engineers, and teams maintaining Swift codebases who need to write reliable tests or modernize existing test suites. Common use cases include creating new unit tests for Swift applications and libraries, reviewing assertion usage, converting XCTest assertions such as XCTUnwrap or XCTFail, evaluating framework compatibility, and determining appropriate boundaries between Swift Testing, XCTest, and XCUITest.
FAQ
When should I use Swift Testing instead of XCTest?
Use Swift Testing for new unit tests. XCTest should generally be retained for UI tests, performance benchmarks, and snapshot tests.
What is the difference between #expect and #require?
#expect records a failure but allows the test to continue, while #require records a failure and stops execution, making it appropriate when later assertions depend on a value being available.
Does Swift Testing run tests sequentially by default?
No. Swift Testing runs tests in parallel by default, so tests should not depend on execution order or shared mutable state.
How can tests be forced to run one at a time?
Use a serialized suite with @Suite(.serialized) when tests interact with shared external state and must not execute concurrently.
What platform requirements are mentioned for this framework?
The skill specifies Swift Testing for Xcode 16+ and Swift 6+ environments.
Install swift-testing
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
dpearson2699/swift-ios-skills