swift-testinglisted
Install: claude install-skill dpearson2699/swift-ios-skills
# Swift Testing
Swift Testing is the modern testing framework for Swift (Xcode 16+, Swift 6+). Prefer it over XCTest for all new unit tests. Use XCTest only for UI tests, performance benchmarks, and snapshot tests.
## Contents
- [Basic Tests](#basic-tests)
- [@Test Traits](#test-traits)
- [#expect and #require](#expect-and-require)
- [@Suite and Test Organization](#suite-and-test-organization)
- [Known Issues](#known-issues)
- [Additional Patterns](#additional-patterns)
- [Parameterized Tests In Depth](#parameterized-tests-in-depth)
- [Tags and Suites In Depth](#tags-and-suites-in-depth)
- [Async Testing Patterns](#async-testing-patterns)
- [Traits In Depth](#traits-in-depth)
- [Common Mistakes](#common-mistakes)
- [Test Attachments](#test-attachments)
- [Exit Testing](#exit-testing)
- [Review Checklist](#review-checklist)
- [References](#references)
---
## Basic Tests
```swift
import Testing
@Test("User can update their display name")
func updateDisplayName() {
var user = User(name: "Alice")
user.name = "Bob"
#expect(user.name == "Bob")
}
```
## @Test Traits
```swift
@Test("Validates email format") // display name
@Test(.tags(.validation, .email)) // tags
@Test(.disabled("Server migration in progress")) // disabled
@Test(.enabled(if: ProcessInfo.processInfo.environment["CI"] != nil)) // conditional
@Test(.bug("https://github.com/org/repo/issues/42")) // bu