Search⌘ K
AI Features

Introduction to Shrinking

Explore the concept of shrinking in property-based testing using PropEr. Learn how shrinking reduces complex failure cases to minimal examples by guiding the framework to simplify data, making debugging easier. Understand the use of ?SHRINK and LETSHRINK macros to control shrinking behavior when default shrinking is insufficient.

We'll cover the following...

Shrinking

A critical component of property-based testing is shrinking. Shrinking is 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 to a simple counterexample truly is the killer feature.

But there are some cases where PropEr can’t do what we need. Either it can’t shrink large data structures well enough to be understandable, or ...