Unit Testing Storyboard Segues
summary
Shows how to unit test storyboard segues in Swift by replacing UIViewController present implementations with a runtime method swizzling spy that posts notifications and captures the presented view controller, letting tests assert the presented VC type and passed model data. Uses key‑value coding to inspect segue templates for table cells and gesture recognizers, simulates taps by selecting rows or triggering performSegue, pumps the run loop during teardown, and keeps all changes inside the test target so there are no production code changes.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 1:28Why test storyboard segues
- 2:52What happens during a segue
- 4:37Challenges in testing segues
- 7:10Implementing the swizzle spy
- 9:19Setting up the test spy
- 11:15Testing segue existence
- 13:24Accessing segues from table cells
- 14:13Testing gesture recognizer segues
- 15:37Testing table row segues
- 16:24Summary and acknowledgments
related talks
37miOS Testing: Beyond the Model
38mTesting and Declarative UI's
29mThe Magic of UI Testing
32mVenturing Into the world of RxSwift unit testing
54mTest Driven Development (TDD) by Controlling Dependencies
30mUnlocking the Power of Swift Testing: Modern Approaches to Testing iOS Apps
32mUI Automation with XCUITest
48mUI Tests in an iOS Project
