QuickCheck: An Automatic Testing Tool for Haskell
This page refers to the original version of QuickCheck, developed
in Haskell. For information on the commercial version,
see quviq.com
Koen Claessen and John Hughes
QuickCheck is a tool for testing Haskell programs automatically. The
programmer provides a specification of the program, in the form of
properties which functions should satisfy, and QuickCheck then tests that the
properties hold in a large number of randomly generated cases. Specifications
are expressed in Haskell, using combinators defined in the QuickCheck
library. QuickCheck provides combinators to define properties, observe the
distribution of test data, and define test data generators.
Resources
- Our paper
from ICFP 2000.
- A new paper (presented at the Haskell Workshop 2002) on testing monadic programs, especially in the ST
monad.
- An online manual.
- Module QuickCheck (distributed with Hugs and GHC).
- Module ShowFunctions, required
with newer versions of Hugs (distributed with GHC).
- quickCheck, a program to invoke quickCheck for all properties in a
module (this version invokes ghci, but is easily modified to run hugs instead).
- A warning on problems with random number
generation under old versions of Hugs.
- QuickCheckM, which extends
QuickCheck with monadic property combinators. This module uses the
ST monad, so is not pure Haskell 98. It is the version which our
Haskell workshop paper describes.
User Experiences
Current Developments
We currently have several experimental versions of QuickCheck,
including one integrated with the Hat tracing tool. The next job is to
merge them all back together again!
Other Languages
Similar libraries have been implemented for many other programming
languages, from Scala to Google's Go--too many to keep an up-to-date
list here. A commercial version in Erlang is marketed by our
associated company, Quviq.