Unit Test the Observation Framework

When I heard about the new Observation framework in WWDC 2023, like all good fans of Combine (we still exist!), I was naturally horrified.

Combine is no longer an implementation detail of SwiftUI. Our hard-earned knowledge of testing @Published properties is deprecated.

Today, we’re going to discover how to unit test @Observable view models.

This is a sequel to my six-part epic, Async Unit Testing in Swift. I’ll be updating Bev, my trusty, boozy side project, to iOS 17 while maintaining full test coverage.

Website