Training | Property-based testing in Scala

Get more confidence in your code while writing fewer tests using this one weird trick: properties-based testing.

scala

Overview

Property-based testing is a powerful technique to increase 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 scalacheck, a library that enables PBT in Scala

Prerequisites

  • Previous experience with Scala
  • Experience writing tests.
  • IntellIJ IDEA, JDK 8. We'll provide sources.

What you'll learn

  • The value of property based testing.
  • scalacheck as an implementation of PBT.
  • The concept of generators.
  • How to write our own generators.
  • Writing generators for data types or type class instances.
  • Properties. What are they?
  • Identifying properties of our software.
  • Writing software with PBT in mind.
  • Using default generators with properties.
  • Using constrained generators with properties.
  • Retrying a failed property.
  • Real use cases where property based testing applies well.

Related courses upcoming in the Academy

Skills

This Property-based testing in Scala 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