Project | Test quality
Property-Based Testing with QuickTheories
Bill splitting, a booking calendar, a run-length codec and a stock ledger, checked with generated inputs, round trips, a simple oracle and a stateful model check, with steered generators and documented shrinking limits.
27 tests state rules that must hold for every input and check each on 1,000 generated inputs. Four buggy first drafts were each shrunk to the smallest failing example, such as 1 cent split between 2 people.
Evidence checked 14 Nov 2026 | Scheduled CI run on main
On this page
Problem and purpose
Example-based tests only check the cases someone thought of. Property-based tests generate the inputs, so they find the case nobody wrote down, and shrinking turns a long random failure into a regression example a person would write. This complements the PIT project: PIT changes the code, property-based testing changes the inputs.
Architecture
generator ──► 1,000 inputs ──► property (a rule for every input)
└ fails ──► shrink to the smallest failing input ──► print it with the seedTechnology and tools
| Area | Tools |
|---|---|
| Code | Java 21: a bill splitter, a booking calendar, a run-length codec and a stock ledger |
| Tests | QuickTheories 0.26 with TestNG 7.12 and AssertJ: 27 tests, 1,000 inputs per property |
| Generators | Test data objects that steer the random inputs towards edges, overlaps and look-alike encodings |
| CI | GitHub Actions: 1,000 inputs per push; the weekly run checks 20,000 per property; the shrinking table goes into the job summary |
Engineering decisions and approach
- Buggy first drafts live in test code only, so the shrinking demos never ship
- An oracle that is obviously right: a BitSet of busy minutes for the calendar
- A stateful model check runs random command sequences on the real ledger and a two-field model
- Bad input must fail in one documented way, never with an index or memory error
- Only shrunk values from single-source generators are pinned, because mixed generators shrink differently per JDK
Test scope and execution approach
Project-specific checks and execution details documented in the repository:
- Four first drafts shrunk to minimal examples: 1 cent between 2 people, two touching minutes, one release call
- Round-trip property for any Unicode text, including emoji and the separator character
- Generators with edge values mixed in, such as amounts of 0, 1, 99 and 100 cents
- A failure is reproducible with its seed
- Documented limits of the unmaintained library, measured on two JDKs
Results with dated evidence
Historical repository or workflow evidence
Scheduled CI run on main
27 tests state rules that must hold for every input and check each on 1,000 generated inputs. Four buggy first drafts were each shrunk to the smallest failing example, such as 1 cent split between 2 people.
Evidence checked: | Open dated evidence
Evidence explorer
Static screenshots are labelled as images; dated workflow links identify the execution evidence and its check date.
Real run with seed 20261111: the bill splitter that dropped the remainder failed after 2 examples and shrank to {1 cents, 2}; the codec without a separator to 1; the calendar with < instead of <= to [09:00-09:01, 09:01-09:02]; the ledger to [Release[quantity=1]]. The full table is in the README and in each CI job summary.
Static material from the public repository. The linked verification record was checked 2026-11-14; that date is not a screenshot capture date.
Dated workflow record
Evidence checked 2026-11-14. Open Scheduled CI run on main
Local setup and execution
mvnw.cmd test :: 27 tests, 1,000 inputs per property
mvnw.cmd test -Dqt.examples=20000 :: deeper, like the weekly CI runWorkflow and reports
Known limitations
- QuickTheories 0.26 is from 2019 and no longer maintained
- Generators built with mix() can stop shrinking early, at a point that depends on the JDK
- Numbers shrink close to a boundary, not always onto it; the exact boundary is then written as an example test
- QuickTheories 0.26 is no longer maintained, and shrinking with mixed generators depends on the JDK (documented in the repository).