8 Property-based testing
This chapter covers
- Understanding property-based testing
- Fabricating test data using generators
- Minimizing test case outcomes to give meaningful feedback
- Using properties to affirm laws
In chapter 7, we worked through the design of a functional library for expressing parallel computations. We introduced the idea that an API should form an algebra —that is, a collection of data types, functions over these data types, and, importantly, laws or properties that express relationships between these functions. We also hinted at the idea that it might be possible to somehow validate these laws automatically. Validation is an important step, as we need to know that the code we write conforms with the laws we have imposed on ...
Get Functional Programming in Kotlin 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.