What problem does it solve?
Provides a practical, opinionated reference for writing and migrating tests to the Swift Testing framework so teams can replace brittle XCTest patterns with composable, observable, and parameterized test suites that run reliably in CI and locally.
Core Features & Use Cases
- Parameterized tests & generators: run argument collections, ranges, enums, cartesian products, and zipped inputs as separate test cases.
- Assertions & control flow: use #expect for non-fatal checks and #require to assert and unwrap values needed for subsequent assertions.
- Traits, tags, and suites: define reusable traits, tag tests for selective runs, and organize tests with @Suite including suite-level setup and teardown.
- Async & concurrency patterns: confirmation-based async event testing, actor isolation handling, time limits, and programmatic cancellation.
- Test doubles & architecture: protocol-based mocks, TestScoping fixtures, and patterns for testable dependency injection.
- Migration & interoperability: guidance to convert XCTest UI/performance/snapshot tests to appropriate XCTest usage while using Swift Testing for unit and integration tests.
- Attachments & exit testing: attach diagnostic data and capture exit/fatal scenarios for robust debugging.
Quick Start
Create a parameterized Swift Testing unit that uses @Test with arguments, asserts behavior with #expect, and applies a Tag to filter runs in CI.