Swift Testing: A testing framework for modern Swift
summary
A new Swift testing framework uses @test / @suite macros and runtime macros like pound expect / pound require to test an RPN stack (push, pop throws on empty) and an async timesTwo method; expect records failures and continues while require halts subsequent checks, parameterized tests run each case independently (maximum two parameters), suites run in parallel/random order unless marked serialized, supports knownIssue skipping and timeLimit, requires Swift 6 and has limited CLI tag filtering; custom macros add compile-time cost.
AI-written summary · about
chapters (10)
- 0:00Introduction to Swift Testing
- 3:57Writing first test case
- 7:16Expect vs require expectations
- 9:24Eliminating test repetition
- 11:32Testing async code
- 14:53Handling known failures
- 16:19Time limits and skipping tests
- 18:07Parameterized testing
- 21:43Macros in Swift Testing
- 22:27Q&A session
related talks
30mUnlocking the Power of Swift Testing: Modern Approaches to Testing iOS Apps
26mTesting the Tricky Stuff
36mTesting Asynchronous Code in Swift 5.5
01h 01m"unit"_test: Implementing a Macro-free Unit Testing Framework from Scratch in C++20
01h 32mFuture of Testing With C++20
31mTesting Time (and other asynchronous code)
34mScripting in Swift For a Testable Build
33mWhat people get wrong about testing and how can you leverage tests to develop a lot faster!
