Skip to the content
Know your tech before you buy it. Makers: get listed from $49/mo

QCheck

github.com

  • Free plan
  • Linux
7.1 Club score Visit github.com

What QCheck is

QCheck is a free, QuickCheck-inspired property-based testing library for OCaml. Developers can build random generators and use generated values to check properties, with combinators for lists, arrays, tuples, recursive types, and algebraic types. Generators can be paired with printers and shrinkers to show and reduce counterexamples when a property fails. QCheck2 has shrinking built into its generators, although the project describes it as less battle-tested than QCheck. Available opam packages include qcheck-core, qcheck-ounit, qcheck-alcotest, qcheck, and ppx_deriving_qcheck, which can derive generators from type declarations. Runner options include QCheck_base_runner in qcheck-core and QCheck_runner with OUnit compatibility in qcheck. Integration layers are available for OUnit and Alcotest, and the project points to qcheck-stm and qcheck-lin for model-based and sequential consistency tests. Installation is available through opam, and the source can be built with make. The minimal qcheck-core package depends only on unix and dune. The project uses the BSD-2-Clause license.

Who it suits

QCheck suits OCaml developers who want to check properties over generated inputs rather than rely only on individual examples. Its runner and integration packages offer options for projects using OUnit or Alcotest.

Good to know, and what to watch

  • Generator combinators cover common and recursive types.
  • Shrinkers can reduce failing counterexamples.
  • QCheck2 integrates shrinking into generators.
  • Provides OUnit and Alcotest integration layers.
  • Minimal qcheck-core depends only on unix and dune.
  • QCheck2 is described as less battle-tested than QCheck.
  • The library supports OCaml.
  • Installation instructions use opam or make.

QCheck

Free

Free plan

Getting started

  1. Install opam if it is not already available
  2. Install qcheck-core or qcheck with opam
  3. Choose OUnit or Alcotest integration when needed
  4. Build the source with make if using a source checkout
  5. Add generators, printers and shrinkers to property tests

Limits to check

QCheck has a free plan. qcheck-core is the minimal package, while QCheck2 is identified as less battle-tested than QCheck.

The Club's review

QCheck is an OCaml property-based testing library for developers who want generated inputs to challenge program invariants, not just a fixed set of examples. It suits projects that need control over dependencies and test-runner integration, with enough tooling for both routine unit properties and stateful models.

Overview

QCheck follows the QuickCheck style: describe a property, generate many values, and examine a reduced failing case when the property does not hold. Its opam package family lets a project start with a small core and add framework adapters or derived generators as its test suite grows.

The recommended qcheck-core package depends only on unix and dune, a sensible choice for libraries where dependency surface matters. QCheck is released under the BSD-2-Clause license.

Key features

Generators and counterexamples

Combinators produce lists, arrays, tuples, recursive values and algebraic types. Generators can be paired with printers and shrinkers, so a failed property yields a smaller, more intelligible counterexample instead of an arbitrary large input. That shortens diagnosis for developers dealing with complex data structures.

QCheck2 shrinking

QCheck2 incorporates shrinking into its generators, removing the need to implement shrinkers manually when using that API. It is an attractive path for new code, but the project characterizes QCheck2 as newer and less battle-tested than QCheck. Conservative teams may therefore prefer the established API until they are comfortable with that trade-off.

Packages and runners

The collection includes qcheck-core, qcheck, qcheck-ounit, qcheck-alcotest and ppx_deriving_qcheck. QCheck_base_runner comes with qcheck-core; qcheck adds QCheck_runner and OUnit compatibility. Dedicated OUnit and Alcotest layers fit teams already using those frameworks, while ppx_deriving_qcheck can derive generators from type declarations and reduce repetitive setup.

Broader testing models

QCheck supports stateful testing, and the multicoretests work referenced by the project extends it with qcheck-stm for sequential and parallel model-based tests and qcheck-lin for sequential-consistency testing. These options make it relevant to concurrent systems, although they are more specialized than ordinary property checks. The project also describes using QCheck with Rely through an npm package.

Pricing

QCheck — free. This is a free OCaml property-based testing library under BSD-2-Clause, with no paid tier or usage quota indicated. It fits individual developers, open-source maintainers and organizations that want to adopt property testing without a license budget; the trade-off is that support and commercial terms beyond the open-source license are not part of the offering.

Platforms

QCheck targets Linux and supports OCaml. Installation is available through opam, including commands for qcheck-core and qcheck, and the source can be built with make. That makes it a natural fit for OCaml toolchains on Linux, but it is not presented as a cross-platform library.

Who it's for

Choose QCheck for OCaml teams building libraries or applications where generated coverage can expose edge cases that example-based tests miss. It is particularly suitable when you need OUnit or Alcotest integration, want to keep a minimal dependency set, or expect to test stateful and concurrent behavior. Teams seeking the most conservative API choice should favor established QCheck interfaces; those prioritizing integrated shrinking can evaluate QCheck2 with its maturity caveat in mind.

Pros and cons

  • Pros: broad generators cover common and recursive OCaml data; printers and shrinkers produce actionable failures; QCheck2 can shrink without hand-written shrinkers; runner packages accommodate QCheck, OUnit and Alcotest; qcheck-core keeps dependencies to unix and dune; type derivation can reduce boilerplate.
  • Cons: QCheck is Linux-focused; the package choices and separate integration layers require decisions about the test stack; QCheck2 is explicitly less battle-tested, which may matter for production-critical suites.

Alternatives

For JavaScript property testing, JSVerify is the free self-hosted or web option. Ruby teams can choose PropCheck, a free MIT-licensed gem requiring Ruby 2.5.1 or newer. Racket QuickCheck suits Racket projects across Linux, macOS and Windows. Scala users should choose ScalaCheck, while .NET/F# teams should look at FsCheck and its NuGet distribution. Go developers can use Gopter. Haskell projects should choose QuickCheck. JavaScript or TypeScript teams wanting a MIT-licensed project can consider fast-check.

See the Property-Based Testing Tools list for a wider comparison.

Verdict

QCheck is a strong choice for OCaml teams that want flexible generators, useful failure reduction and integration with established test runners at no cost. Choose it when Linux and OCaml are your environment and dependency control matters; look elsewhere when you need another language or platform, or when QCheck2's newer maturity profile is unacceptable.

The verdict

QCheck offers OCaml teams generators, counterexample reduction, and several runner and integration options. The project flags QCheck2 as less battle-tested, so that distinction matters when selecting its API.

Questions people ask

How much does QCheck cost?

QCheck is free, with a free plan priced at no cost.

Which language and platform does it support?

QCheck supports OCaml and lists Linux as its platform.

Which test runners integrate with QCheck?

Supported runners and layers include QCheck_base_runner, QCheck_runner, OUnit and Alcotest.

Can QCheck shrink failing cases?

Yes. Generators can use printers and shrinkers, and shrinking is integrated into QCheck2 generators.

Is QCheck open source?

The repository identifies a BSD-2-Clause license and says the code is released under the BSD license.

How can I install it?

The project provides opam installation commands for qcheck-core and qcheck, and the source can be built with make.

What the maker publishes

Core dependencies
The README says qcheck-core depends only on unix and dune and recommends it for a minimal installation. source
Counterexamples
Generators can be paired with printers and shrinkers to display and minimize counterexamples when a property fails. source
Documentation
The project documentation site lists documentation for five opam packages, with qcheck-core, qcheck, qcheck-alcotest, and qcheck-ounit at version 0.91 and ppx_deriving_qcheck at 0.9. source
Generators
QCheck includes combinators for constructing random generators, including generators for lists, arrays, recursive types, algebraic types, and tuples. source
Install
The README gives opam install commands for qcheck-core and qcheck, and says the source can be built with make. source
Installation
QCheck can be installed through opam, and the README recommends qcheck-core for a minimal dependency set. source
Integrated shrinking
The README says shrinking is built into QCheck2 generators, so users do not need to hand-write shrinkers for that API. source
Integrations
The project provides integration layers for OUnit and Alcotest, and the README describes using QCheck with Rely through an npm package. source
License
The repository identifies its license as BSD-2-Clause and says the code is released under the BSD license. source
Maintainer
The project page says it is maintained by c-cube, whose GitHub profile identifies Simon Cruanes. source
Maturity note
The README describes QCheck2 as newer and less battle-tested than QCheck. source
Model-based testing
The README points to the multicoretests repository for qcheck-stm, which runs sequential and parallel model-based tests, and qcheck-lin, which tests sequential consistency. source
Package collection
The project provides opam packages including qcheck-core, qcheck-ounit, qcheck-alcotest, qcheck, and ppx_deriving_qcheck. source
Packages
The project provides opam packages including qcheck-core, qcheck-ounit, qcheck-alcotest, qcheck, and ppx_deriving_qcheck. source
Purpose
QCheck is a QuickCheck-inspired property-based testing library for OCaml. source
QCheck2
QCheck2 integrates shrinking into its generators and the README describes it as less battle tested than QCheck. source
Random generators
QCheck includes combinators for generating values such as lists, arrays, tuples, recursive types, and algebraic types. source
Test runners
The qcheck-core package includes QCheck_base_runner, and the qcheck package includes QCheck_runner with OUnit compatibility. source
Type derivation
The ppx_deriving_qcheck package can automatically derive generators from type declarations. source

Checked against the maker's pages on 7 Oct 2026.