-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

SwiftUI Cookbook
By :

In this recipe, we are going to explore a powerful way of testing views: snapshot testing.
While snapshot testing is more common in other technologies—for example, JavaScript and the Jest testing library (https://jestjs.io/docs/en/snapshot-testing.html)—its usage in the iOS community is still a niche practice.
The aim of snapshot testing is to verify that the layout of a view is preserved while the code of the app is evolved and changed. To achieve this, we take a snapshot of the view that acts as a reference image.
A snapshot test consists of two steps:
Another name for snapshot testing is characterization testing. If you want to know more, here is a definition by Michael Feathers, the guru of improving legacy code: https://michaelfeathers.silvrback.com...