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
- 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.