swift-testing
Swift Testing
Apple's Swift Testing framework — the default test framework in Xcode 16+ and recommended through Xcode 26. @Test/@Suite types, #expect/#require macros, traits, parameterized tests, confirmation(), and the incremental XCTest migration. The full API reference — every macro form, trait, suite/setup pattern, async + error testing, the XCTest mapping tables, and what stays in XCTest — lives in references/guide.md. This file is the decision and discipline layer: read it first, open the guide for specifics.
Dials
Set these explicitly at the start; they change what "correct" means.
FRAMEWORK—swift-testing(default for all new unit/integration tests) ·xctest-still-needed(UI automation withXCUIApplication, or performancemeasure/XCTMetric— these have no Swift Testing equivalent and stay in XCTest).STYLE—flat-@Test(free@Testfunctions, no shared state) ·@Suite(a type grouping tests, with per-test fixtures via stored properties andinit/deinit).DATA—single(one set of inputs per test) ·parameterized(@Test(arguments:)runs the test once per input, each reported and re-runnable on its own).
When to use
Writing or reviewing any unit or integration test for Swift code, or migrating an XCTest suite. Swift Testing and XCTest run in the same target — migrate file by file, don't rewrite wholesale. For the async/await and Sendable mechanics a test exercises, pair with swift-concurrency. Run the suite with xcodebuild test -scheme "<Scheme>" -destination 'platform=iOS Simulator,name=<device>'.