Training | Property-based testing in Swift

Boost your testing skills with property-based testing and increase your confidence in the correctness of your code.

swift

Overview

Property-based testing is a powerful technique for increasing trust in the correctness of our code. Being complementary to example-based or parametric testing, this testing technique focuses on finding universal properties that can be asserted for parts of our software, and verifying them on large sets of inputs. In this course we will use SwiftCheck, a library that enables PBT in Swift.

Prerequisites

  • Knowledge of Swift.
  • Familiarity with writing tests using XCTest.
  • A computer with macOS and Xcode installed.

What you'll learn

Introduction

  • What is Functional Programming
  • Swift features for Functional Programming: high-order functions, value types, protocols, optionals, functional combinators.
  • Referential Transparency.
  • The Substitution Model

Writing generators

  • What is a generator?
  • Arbitrary and Gen.
  • Generators for primitive types and functions.
  • Generators for custom types

Writing properties

  • What is a property?
  • Using default generators with properties.
  • Using constrained generators with properties.
  • Retrying a failed property.

Finding properties

  • Techniques to find good properties for your software.

Skills

This Property-based testing in Swift includes:

  • Maximum Class Size of 15
  • Access to Academy EduTools Platform
  • Access to Course Materials
  • Certificate of Completion
  • Access to a Private Channel with Trainers in the Academy Slack
  • A Q&A session one week post-course
  • A pre-and-post meeting with our trainers