Snapshot Testing In Swift

Make UI testing that bit easier!

Steven Curtis
3 min readJul 25, 2022
Photo by ShareGrid on Unsplash

Difficulty: Beginner | Easy | Normal | Challenging
This article has been developed using Xcode 12.0, and Swift 5.3

Prerequisites:

Terminology:

Snapshot testing: A way to test UI by rendering a UI component, take a snapshot, and then compare it to a reference snapshot file

UBER have ios-snapshot-test-case. At the time of writing, this library does not support Swfit Package Manager — and as I result I used PODS to install this dependency (adding the following in my Podfile)

Then perform a pod install that will create SnapshotTesting.xcworkspace for you.

Now to open the project the reader should then always use SnapshotTesting.xcworkspace to open the project, and if you have downloaded the repo you are probably best served by performing a pod update in the…

--

--

No responses yet