Automated tests are important to maintaing a robust code base. However, conventional unit tests are often overly specific and only test an arbitrary subset of possible scenarios. Furthermore, they rarely serve as good documentation. Property based tests can help mitigage some of these issues by focusing on describing the relationship between inputs and outputs, and running those tests with a randomly generated set of values. It has been used successfully in functional programming languages for two decades and is now easily achievable in Swift using SwiftCheck, a pure Swift port of one of Haskell's most prominent testing libraries.
In this talk, Sebastian gives an introduction to property based testing using the SwiftCheck library. The focus is on familiarising the audience with the concepts of properties, generators and shrinking, and how to apply them to their own code to achieve more meaningful tests and better code coverage. Examples are given in Swift using the SwiftCheck library, but apply to other languages and QuickCheck-style libraries as well.
Slides with speaker notes and sample code will be made available after the talk for further study.
Sebastian is a mobile developer at Canva, empowering the world to design on the go. He is passionate about writing robust code and believes that better developer tools are essential in delivering better user experiences. As a long time Mac and iOS developer, he now gladly sacrifices compile speed and ABI stability for a type system that actually helps him write better code. Before joining Canva, Sebastian worked on award winning education apps for children, which have been featured both in the App Store and on devices in Apple Stores around the world.