QuickCheck is a free Haskell library for testing program properties against randomly generated cases. Developers express specifications with QuickCheck combinators and can use combinators to define test-data generators and examine the distribution of generated data. The Test.QuickCheck.Monadic module provides monadic property testing; the library also supports stateful testing, shrinking failing cases and reproducible failures. The package README describes adding QuickCheck to project dependencies for use in tests or a REPL. A companion package, quickcheck-instances, supplies instances for types in Haskell Platform packages, with additional dependencies. QuickCheck is licensed under BSD-3-Clause and lists dependencies including base, containers, random, splitmix, template-haskell and transformers. Hackage reports testing with GHC versions from 8.10 up to but not including 9.15, as well as Hugs. A make-hugs script creates a Hugs-compatible version and may be useful with other non-GHC implementations. Hackage lists QuickCheck-2.18.0.0 as a downloadable Cabal source package.
Who it is for
QuickCheck suits Haskell developers who want to check program properties using generated inputs. Its generator and distribution combinators can support testing that requires custom test data.
What is good
- Specifications and generators use Haskell combinators
- Supports shrinking failing cases
- Supports stateful and monadic property testing
- Licensed under BSD-3-Clause
What to know first
- Requires Haskell project dependencies
- Companion package adds dependencies
- Reported GHC testing is below version 9.15
Verdict
QuickCheck provides property-testing tools for Haskell, including generators, shrinking and stateful tests. Review its dependency list and reported compiler compatibility before adding it to a project.
QuickCheck plans and pricing
All plansCompared on property-based testing tools
- Free plan
- Yes
- Supported languages
- Haskell
- Test runner support
- Test.SmallCheck.Drivers
- Failing-case shrinking
- Yes
- Stateful testing
- Yes
- Reproducible failures
- Yes
