Why QuickCheck can be useful

29 Jan 2015

One of the many challenges when doing Test-Driven Development is to come up with good enough random input values, in such a way that the system under test (SUT) can be exercised every time though the same code path.

These random input values, that exercise the SUT every time through the same code path, belong into a category, or set, or class, named Equivalence Class, after the xUnit Test Patterns book terminology.

QuickCheck provides a DSL, through its various combinators, that allows you to create and consume such Equivalence Classes.

A practical use of Equivalence Classes can be found at the Equivalence Classes, xUnit.net, FsCheck, Property-Based Testing NDC talk by Mark Seemann.

QuickCheck also provides a sophisticated mechanism for executing test cases multiple times, and doing analytics through the concepts of classifying and shrinking, when reporting back the test results.

In-depth introduction for QuickCheck can be found in the original paper, and for FsCheck can be found in this article by Scott Wlaschin.

QuickCheck is created by Koen Claessen and John Hughes. FsCheck is created by Kurt Schelfthout as a port of QuickCheck.