Chapter 7Shrinking
A critical component of property-based testing is shrinking—the mechanism by which a property-based testing framework can be told how to simplify failure cases enough to let us figure out exactly what the minimal reproducible case is. While finding complex obtuse cases is worthwhile, being able to reduce failing inputs (data generated) to a simple counterexample truly is the killer feature here. But there are some cases where what PropEr does isn’t what we need. Either it can’t shrink large data structures well enough to be understandable, or it’s not shrinking them the way we want it to. In this chapter we’ll see two ways to handle things: the ?SHRINK and the LETSHRINK macros, which let us give the framework hints about ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access