QuickTheories
github.com
What it is
QuickTheories is a free, open-source property-based testing library for Java 8. It checks general properties and invariants by generating random valid inputs, then automatically searches for smaller or simpler values that still fail a property. The library reports the seed for a falsified property, and tests can use fixed seeds for deterministic runs. Its generator DSL creates common Java types, constrains values, and combines or converts generators for custom types. QuickTheories works with JUnit, TestNG, and other test frameworks; `checkAssert` supports assertion libraries such as AssertJ and Hamcrest. The `forAll` API handles theories over one to four generated values. System properties configure seeds, example counts, and shrink attempts, while named profiles can reuse settings. An experimental coverage feature targets new code paths, but may reduce performance by about 10% and interfere with JaCoCo or other coverage systems. The project uses the Apache-2.0 license.
Spec sheet
- Purpose
- QuickTheories is a property based testing library for Java 8, described as a Java version of QuickCheck.Read 7 Oct 2026 · github.com
- Audience
- The README describes the library for Java developers who want to test general properties and invariants of their code.Read 7 Oct 2026 · github.com
- License
- The repository identifies its license as Apache-2.0.Read 7 Oct 2026 · github.com
- Maker
- The README says QuickTheories was produced at NCR Edinburgh as part of its graduate training program.Read 7 Oct 2026 · github.com
- Assertions
- The checkAssert method lets tests use assertion libraries such as AssertJ and Hamcrest.Read 7 Oct 2026 · github.com
- Configuration
- The QT_SEED, QT_EXAMPLES, and QT_SHRINKS system properties configure the random seed, examples per theory, and shrink attempts.Read 7 Oct 2026 · github.com
- Coverage guidance
- An experimental coverage feature can focus search on examples exercising new code paths; the README says it may reduce performance by about 10% and interfere with JaCoCo or other coverage systems.Read 7 Oct 2026 · github.com
- Coverage limitation
- Coverage guidance attaches an agent to the JVM, can reduce performance by about 10%, and may interfere with JaCoCo or other coverage systems.Read 7 Oct 2026 · github.com
- Generators
- Its generator DSL can create common Java types, constrain generated values, and combine or convert generators for custom types.Read 7 Oct 2026 · github.com
- How it tests
- It checks properties by automatically generating random samples of valid inputs.Read 7 Oct 2026 · github.com
- Input generation
- It automatically generates random samples of valid inputs to check whether properties hold.Read 7 Oct 2026 · github.com
- Origin
- The project was produced at NCR Edinburgh as part of its graduate training program.Read 7 Oct 2026 · github.com
- Profiles
- Named profiles can reuse configurations across properties and can be selected with the QT_PROFILE system property.Read 7 Oct 2026 · github.com
- Repeatability
- Tests can use a fixed seed for deterministic runs, and QuickTheories reports the seed when a property is falsified.Read 7 Oct 2026 · github.com
- Shrinking
- It automatically tries to find smaller or simpler values that still falsify a property, without requiring custom shrinking code for each type.Read 7 Oct 2026 · github.com
- Test frameworks
- QuickTheories can run with JUnit, TestNG, or another test framework.Read 7 Oct 2026 · github.com
- Usage limit
- The forAll API supports theories over between one and four generated values.Read 7 Oct 2026 · github.com
Plans and prices
Strong points and limits
Strong points
- Generates random valid inputs automatically
- Shrinks failures without custom code per type
- Reports seeds for reproducible failures
- Supports JUnit, TestNG, and other frameworks
- Apache-2.0 open-source license
Limits
- `forAll` supports only one to four generated values
- Coverage mode may reduce performance about 10%
- Coverage mode may interfere with JaCoCo
Who it suits
QuickTheories suits Java developers testing broad properties and invariants rather than only hand-written examples. It fits projects using JUnit, TestNG, or another test framework.
Verdict
QuickTheories gives Java tests generation, shrinking, and repeatable failure reporting in one library. Its experimental coverage guidance adds a tradeoff for teams already using coverage tooling.
Where Specifiction places it
- Property-Based Testing Tools#10 of 287.7