Swift Testing - Xcode - Apple Developer
Docs
- GitHub
- Documentation
- WWDC24: Meet Swift Testing | Apple - YouTube
- WWDC24: Go further with Swift Testing | Apple - YouTube
Deep Dives
- Video series: Swift and Tips | Mastering Swift Testing series
- Mastering the Swift Testing Framework | Fatbobman’s Blog
- Swift Testing: Getting Started| Kodeco
Cheat Sheet
withKnownIssues
mark a failing test as known so that it will still pass.- This is helpful for passing CI tests for issues that can’t be fixed right now
Use #require
to unwrap
Passing in parameters into a test
Passing multiple parameters
arguments
can receive anything conforming to Collection
. Here are a few examples.
Serial vs. Parallel
Swift Testing is parallel by default.
To guarantee that a test suite is run in a particular order use @Suite(.serialized
. By using this, you will guarantee that the tests are run in a particular order. However, your tests will take longer because they cannot be run in parallel.