Snapshot testing is a useful testing strategy for iOS apps. PointFree’s snapshot testing library (https://github.com/pointfreeco/swift-snapshot-testing) is excellent to create these kinds of tests, but when using Xcode Cloud as CI provider, this library doesn’t work out of the box with it.
In this video I will show why snapshot testing is useful and how to overcome the problems of integration with Xcode Cloud.
The original inspiration for this video was taken from http://jaanus.com/snapshot-testing-xcode-cloud/ where I expanded with my own explanations and approach
As part of the examples I’ve prepared 2 pull request for this video:
1. A minimum approach on how I would fix snapshots testing integration with Xcode Cloud (https://github.com/fespinoza/sample-json-app/pull/8)
2. A more complete approach with utility types that I would use in real projects (https://github.com/fespinoza/sample-json-app/pull/7)
There also some other tricks when it comes to make SwiftUI views easier to preview/snapshot test that can be found in the repository which I may make a video about if people are interested and comment below 👇
#ios #xcodeCloud #testing #ci
--------------------------------
👋 You can find me in
--------------------------------
- Github: https://github.com/fespinoza
- X/Twitter: https://twitter.com/fespinozacast
Chapters:
00:00 Introduction
00:17 Why using snapshot testing
01:43 The app to test + how to run snapshot test locally
04:35 Configure the test to run in Xcode Cloud (Unsuccessful)
05:59 The problem of running snapshot test in Xcode Cloud
07:00 Solving snapshot testing on Xcode Cloud
13:13 Summary and Outro