FAQ
The questions people ask first, each answered in a few lines, with where to read more.
Does it replace my example tests?
Section titled “Does it replace my example tests?”No. Keep the examples that say something exact, a format a person depends on, and add properties for the rules behind them. A property can keep your cases as examples that run first, every time. Migrating from example tests shows both side by side.
Does it need a runner, or annotations?
Section titled “Does it need a runner, or annotations?”No. A property is a call inside a plain @Test, forAll(…).check(…), and your test framework
runs it as any other test: JUnit 5 or 4, TestNG, Kotest, Spock, or a plain main.
With your test framework has each.
How many inputs does it try?
Section titled “How many inputs does it try?”100 random ones a property, unless .tries(…), PROPTASTIC_TRIES or a profile says otherwise,
after its examples and anything saved from earlier runs. A small domain can run every value
instead, with .exhaustively(). Profiles and budgets and
Every value say more.
Is it deterministic in CI?
Section titled “Is it deterministic in CI?”Each run picks a new seed unless you set one, so each run checks different inputs, which is how it
finds what the last one missed. A failure prints its seed, and the same seed draws the same inputs
on any machine, so any failure can be run again exactly. Set PROPTASTIC_SEED, or .seed(…) on
a property, for a run that’s the same every time. Seeds and replay
Why is a counterexample so small?
Section titled “Why is a counterexample so small?”proptastic shrinks a failing input to the smallest that fails the same way, so what you read is the bug and little else. Shrinking
Is a pass a proof?
Section titled “Is a pass a proof?”No: a pass says the rule held for the inputs drawn. Drawing many, and the edges on purpose, finds
far more than a few hand-picked cases, and How sure is a pass?
works out what one is worth. Running every value of a small domain, with .exhaustively(), is the
exception: there a pass has checked them all.
Does it measure coverage?
Section titled “Does it measure coverage?”A run doesn’t: it draws inputs and checks a rule, and doesn’t watch which lines run. A search with
the proptastic command’s fuzz does, with the agent jar, to steer toward inputs that reach new
branches, but what it keeps for later runs is inputs, and it claims no coverage. To see how often
each kind of input came up, use classify; to know whether your
tests would catch a bug, run mutastic.
Can it test concurrent code?
Section titled “Can it test concurrent code?”Yes: steps on threads, every interleaving within a bound, with .threads(n), and an optional agent
for code written without proptastic in it. Concurrency and
Races in plain code
Is there a Rust or Swift version?
Section titled “Is there a Rust or Swift version?”The Rust edition is being built, and Swift is planned, each with the same words and failures. Editions