… will automatically write your tests for you, with better code coverage and help your maintainability over time, with just one neat trick!

Presentation by Rob Chatfield at Sydney Cocoaheads, March 2019

Example Code : bitbucket.org/rjchatfield/InlineSnapshotTesting

: bitbucket.org/rjchatfield/InlineSnapshotTesting Video : vimeo.com/326120139

: vimeo.com/326120139 Slides: slideshare.net/rjchatfield/inline-snapshot-testing-rob-chatfield-sydney-cocoaheads-march-2019

Kudos to the guys at pointfree.co for making the amazing SnapshotTesting open source library: github.com/pointfreeco/swift-snapshot-testing

Snapshot testing has been around for a while. Facebook popularised Visual Regressions a few years ago with github.com/uber/ios-snapshot-test-case (now maintained by Uber). Instead of testing every ivar of every object, we could test the whole view all at once. Brilliant! However, filling up your git repo with binary files that don’t diff just doesn’t scale.

Next was “snapshotting text-based descriptions”. Game changing! Why be limited to views, when you test literally anything.

Today, we’re going walk through a first principles look at snapshot testing, then introduce Pointfree’s library, then smoosh the two ideas together until we get inline snapshot testing. I’ll also share some tidbits about what we’ve learnt along the way.