© Avi Tsadok 2020
A. TsadokPro iOS Testinghttps://doi.org/10.1007/978-1-4842-6382-2_9

9. Snapshot Testing

Avi Tsadok1 
(1)
Tel Mond, Israel
 

Reminds me of the awesome bug report I saw once: ‘Everything is broken. Steps to reproduce: do anything. Expected result: it should work’.

—Felipe Knorr Kuhn

Introduction

When we think about writing tests, we usually think about defining expected results and then writing tests to validate them. But what if we know our code already executes as expected, and all we want to do is to prevent regression in the future?

Snapshot testing is all about saving our current state persistency once we know it’s stable and then making an ongoing comparison in each run.

In this chapter, you will learn
  • What is Snapshot Testing

  • How to ...

Get Pro iOS Testing: XCTest Framework for UI and Unit Testing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.