How a run works
The other concept pages each take one part of a run. This page puts them in order, so you can see where each fits, and where to look when a run does something you didn’t expect.
When a test calls forAll(…).check(…), proptastic:
- Runs the examples pinned with
.example(…), in order. One that fails is reported as it is, without shrinking. - Replays the counterexample the last run saved, if there is one (Seeds and replay). If it still fails, that’s the failure, and it stays saved; if it passes, the file is deleted.
- Picks the seed: the property’s
.seed(…), elsePROPTASTIC_SEED, else a new one. It records the run inbuild/proptastic/properties.json. - Runs the corpus, the inputs kept from earlier counterexamples, if the property has any.
- Runs the tries: 100 random ones unless
.tries(…),PROPTASTIC_TRIESor the profile says otherwise (How values are drawn). With.exhaustively()it runs every value of a small domain instead, once each. A property that callstarget(score)climbs toward the inputs that score highest as it goes. While they run, the health checks watch for a filter that rejects most inputs, inputs that are too large, and drawing that’s too slow. - Checks what it was told to require: while it can’t yet tell whether a
requirelabel came up often enough, it runs more tries, up to 64 times as many; it fails when the label is surely too rare, and says the label is incomplete when it still can’t tell.
If any input fails, from step 1 to 5, proptastic:
- Runs it once more. If it passes, the failure is flaky, and it’s reported as found.
- Shrinks it to the smallest input that fails the same way (Shrinking).
- Saves it, so the next run tries it first.
- Checks which values mattered (Which values mattered).
- Reports it, in the shape Reading a failure explains, as the message of an assertion failure your test framework reports as it does any other.
Whether it passes or fails, the run writes an event for the property, a JSON
file under build/proptastic/events/ that a tool can read. A pass prints nothing, unless the
property follows a model or a spec, or runs on threads, which say what they checked and
how sure the pass is, or its
require couldn’t tell, which it says as an incomplete pass.