With that in mind, in this book, we'll make extensive use of property-based testing, also called generative testing by some literature. Property-based testing has a slightly different, if similar, workflow to unit testing. When writing property tests, the programmer will:
- Produce a method for generating valid inputs to a system under test
- Write further code to demonstrate that for all valid inputs that a desirable property or property of the system holds
Property-based testing is exceptionally good at finding corner cases in software, wacky inputs that the programmer might not have dreamed up, or, as happens from time to time, even understand as potentially problematic. We'll use Andrew Gallant's QuickCheck, a tool ...