Write unit tests with Swift Testing and XCTest
11 steps · about 3 h 45 min · Intermediate
- Swift Testing (article, jano.dev, 15 min)
A compact tour of @Test, #expect, suites, parameterization and traits, so the vocabulary is clear before the longer material.
- Getting started with Swift Testing (article, Pol Piella, 20 min)
Turns an existing XCTestCase into a Swift Testing suite, which shows what changed and why.
- Swift Testing documentation (reference, Apple Developer Documentation, 30 min)
The official reference for the framework's macros, suites and traits. Use it to check details from here on.
- Swift Testing Framework: Migration Guide & Best Practices (article, Swift Published, 15 min)
Side-by-side XCTest and Swift Testing comparisons: #require unwrapping, flexible names, and merging similar tests into one.
- Go further with Swift Testing - WWDC24 (video, Apple Developer, 27 min)
Covers parameterized tests, the expect-throws macro and parallel execution, the features that go beyond XCTest.
- Migrating XCTest to Swift Testing (blog, Use Your Loaf, 15 min)
Practical migration notes: mixing both frameworks in one target, structs over classes, and not mixing assertions inside a single test.
- Swift Testing: The Framework Replacing XCTest, and What Stays In XCTest (article, Blake Crosley, 12 min)
Explains which tests (UI automation, performance) still belong in XCTest, so you migrate only what makes sense.
- Swift Testing vs XCTest in 2026: Migrating Real iOS Projects to Modern Testing (article, DEV Community, 20 min)
A step-by-step plan for migrating a real project, including setUp and tearDown differences.
- Migrate to Swift Testing - WWDC26 (video, Apple Developer, 21 min)
The newest official guidance. Interoperability lets you migrate XCTest code incrementally with confidence.
- The Ultimate Swift Testing Playbook (guide, Peter Steinberger (GitHub Gist), 30 min)
A broad cheat-sheet to keep once you're writing tests, covering migration patterns and best practices.
- swift-testing (repo, Apple (GitHub), 20 min)
The open-source source and vision docs show how the framework is designed, for when you want to go deeper.