Home

Awesome

The Shrinking Challenge

One of the major aspects in which different property-based testing libraries differ is their approach towards shrinking. This repository collects concrete examples (challenges) for shrinking together with implementations in different frameworks so that one can compare and get a feel for weaknesses and strengths.

Contributing

If you want to contribute

...feel free to add a pull request!

What is Shrinking?

The input data and parameters PBT library use to check a property's invariants, are fully or partially generated through pseudo-randomization. One problem that comes with random generation is the rather loose relation between the randomly chosen sample and the problem underlying the failing property.

That's why it is important for PBT tools to try to find a simpler or even “the simplest” example that fails for (hopefully) the same reason. This searching phase is called shrinking because it starts with the original sample and tries to make it smaller and check the property again. The closer the shrunk sample is to the theoretically smallest one, the easier it is for the developer to recognize the real reason for a failing property.

Two major difficulties in shrinking are:

Different Shrinking Approaches

PBT libraries usually follow one of two approaches:

Another characteristic to differentiate between shrinking approaches is
type-based versus integrated shrinking.

Challenges

Some challenges were stolen from this repository, which contains the code and data relevant to this paper.

ChallengeHypothesisjqwikPropErFsCheckfast-checkCsCheckAmericiumelm-testrapid
bound5reportreportreportreportreportreportreportreport
large union listreportreportreportreportreportreportreportreportreport
reversereportreportreportreportreportreportreportreportreport
calculatorreportreportreportreportreportreportreport
length listreportreportreportreportreportreportreportreport
differencereportreportreportreportreport
binheapreportreportreportreport
couplingreportreportreportreportreportreport
deletionreportreportreportreportreportreport
distinctreportreportreportreportreportreportreport
nestedlistsreportreportreportreportreportreport

PBT Libraries and Frameworks (alphabetically)