moodmosaic

Why QuickCheck can be useful

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 through the same code path.

These random input values, which exercise the SUT every time through the same code path, belong to 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 in 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.

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

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