QuickCheck: A Lightweight Tool for Random Testing of Haskell Programs
π Abstract
QuickCheck is a tool which aids the Haskell programmer in formulating and testing properties of programs. Properties are described as Haskell functions, and can be automatically tested on random input, but it is also possible to define custom test data generators. We present a number of case studies, in which the tool was successfully used, and also point out some pitfalls to avoid. Random testing is especially suitable for functional programs because properties can be stated at a fine grain. When a function is built from separately tested components, then random testing suffices to obtain good coverage of the definition under test.
β¨ Summary
The paper introduced QuickCheck as a lightweight, embedded Haskell framework for property-based random testing. Its core contributions were executable properties, type-directed default generators, programmer-defined generators for controlling input distributions, conditional properties, test-data classification, size control for recursive values, and generation of test functions. The authors also documented an important limitation: passing many tests is not meaningful if generators produce an unrepresentative distribution of inputs. (cs.tufts.edu)
The approach became a foundation for subsequent property-based testing research and tooling. Later work describes property-based random testing explicitly through the QuickCheck model and extends it with coverage guidance in FuzzChick, while more recent research has developed parallel runtimes for QuickCheck. (doi.org) The continuing QuickCheck library documentation retains the paperβs central abstractions, including Arbitrary, Gen, function generation, shrinking, and distribution analysis. (hackage.haskell.org) The paper was presented at ICFP 2000, held September 18β20, 2000, and was published on pages 268β279. (dblp.org)