Snapshot Testing In Swift
Make UI testing that bit easier!
Difficulty: Beginner | Easy | Normal | Challenging
This article has been developed using Xcode 12.0, and Swift 5.3
Prerequisites:
- You will be expected to be aware how to make a Single View Application, or a Playground to run Swift code
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…