Skip to content

Settings and environment

A property says in its code how it runs. Some runs need something else, and you don’t want to edit the code for them: more tries on a nightly build, the seed from a failure so you can reproduce it, no shrinking when another tool runs your properties and only needs to know whether they pass. Settings change that for a whole run, from outside. This page lists every one.

Each setting is an environment variable, such as PROPTASTIC_TRIES, the same name in every edition of proptastic. The settings below come from the table the library itself reads them through, so the page can’t list one it doesn’t read.

Terminal window
PROPTASTIC_TRIES=1000 ./gradlew test --rerun
  • A blank one counts as not set, so the default holds.
  • A property’s code wins for its seed. A .seed(…) in the code beats the seed from outside, so a pinned seed stays pinned.
  • The setting wins for tries. PROPTASTIC_TRIES beats each property’s .tries(…), so one setting changes a whole suite.

In Java, each is also a system property, named from the variable in lower case with dots for underscores: PROPTASTIC_TRIES is proptastic.tries. One that’s set wins over the variable, so a build file can set a setting for its tests with systemProperty("proptastic.tries", "1000").

Use the environment variable. Gradle passes its environment to the tests, but not its -D system properties: ./gradlew test -Dproptastic.tries=1000 sets the property in Gradle’s own JVM, where no test reads it.

Gradle doesn’t count the environment as an input to the test task. When nothing else has changed, it calls the task up to date and runs nothing, so add --rerun to run the tests with the new setting. After a failure the task always runs again, so the rerun: line a failure prints needs no --rerun. proptastic run adds --rerun itself, so a setting always reaches the tests through it.

PROPTASTIC_SEED

Java system property
proptastic.seed
Takes
0x and up to 16 hex digits, as a failure prints it
Default
a new seed each run

The seed every random try is drawn from, so a run can be repeated. A bare number such as 12345 is refused, with the hex form to use. A property's own .seed(…) wins over it.

PROPTASTIC_TRIES

Java system property
proptastic.tries
Takes
a whole number
Default
the property's .tries(…), else 100

How many tries each property makes. It wins over every property's .tries(…), and over what the profile would make.

PROPTASTIC_SHRINK

Java system property
proptastic.shrink
Takes
false turns it off
Default
on

Whether a failure is shrunk. Off, the first failing input is reported as it was found, under counterexample:.

PROPTASTIC_REDRAWS

Java system property
proptastic.redraws
Takes
a whole number, 0 turns it off
Default
20

How many times each value of a shrunk counterexample is drawn afresh, the others held, to tell which values mattered: one that fails every time is named under fails for any:. More draws make that surer, and a failure slower to report. When a filter rejects more than half of them, the value is left out.

PROPTASTIC_PROFILE

Java system property
proptastic.profile
Takes
local, pr or nightly
Default
local

How much a run spends. local makes each property's tries. pr runs every corpus entry, then 10 random tries, whatever the property says. nightly makes 10 times each property's tries, and adds each counterexample to the corpus.

PROPTASTIC_BUDGET

Java system property
proptastic.budget
Takes
a duration: 500ms, 2s, 1m, 1h, or ISO-8601's PT2S
Default
none

The most time a property may spend trying. When it runs out, the property passes, and prints how many tries it made.

PROPTASTIC_CERTAINTY

Java system property
proptastic.certainty
Takes
a chance above 0 and at most 0.05: 1e-9, 0.001
Default
1e-9

How sure require must be before it calls a label's share enough or too rare: the most chance it may be wrong, about each label in a run. Unsure, the run draws more tries, doubling up to 64 times those asked; still unsure, the share is incomplete. A larger chance is told sooner, and wrong more often.

PROPTASTIC_INCOMPLETE

Java system property
proptastic.incomplete
Takes
report or fail
Default
report

What a property does with a require share still unsure at 64 times its tries: report passes it and prints which labels are incomplete and how sure it got; fail fails it, for CI.

PROPTASTIC_REPLAY

Java system property
proptastic.replay
Takes
false turns it off
Default
on

Whether the counterexample a property's last run saved is tried first. Off, counterexamples are neither replayed nor saved.

PROPTASTIC_DIR

Java system property
proptastic.dir
Takes
a directory
Default
build/proptastic, or target/proptastic in a Maven project

Where counterexamples, events and the run's properties.json go.

PROPTASTIC_CORPUS

Java system property
proptastic.corpus
Takes
a directory, or off
Default
.proptastic/corpus

The corpus: inputs kept from past counterexamples, which run before the random tries. off runs none.

PROPTASTIC_CORPUS_RECORD

Java system property
proptastic.corpus.record
Takes
true or false
Default
true in the nightly profile, else false

Whether each failing input is added to the corpus.

PROPTASTIC_CORPUS_REKEY

Java system property
proptastic.corpus.rekey
Takes
true or false
Default
false

Whether each stale corpus entry, kept under the property's domains as they were, is written again under them as they are now when its choices still decode the same: drawn in order, each under the bound it was found with, none left over, and no filter rejecting it. One that doesn't stays stale. proptastic corpus --prune sets it, then drops the entries still stale.

PROPTASTIC_FUZZ_KEEP

Java system property
proptastic.fuzz.keep
Takes
a whole number, 0 keeps none
Default
1000

The most inputs a coverage-guided search keeps for a property in .proptastic/fuzz/. Past it, the least useful go first: those the last search found reached nothing new, then those that first reached the fewest features, the longest first.

PROPTASTIC_MODELS

Java system property
proptastic.models
Takes
a directory
Default
models

Where a model named without a path is found: spec("Reserve", …) reads the graph tla/Reserve.dot under it, and lean("Trading") runs the program Lake built in lean, named trading.

PROPTASTIC_TLC

Java system property
proptastic.tlc
Takes
the path to TLC's tla2tools.jar
Default
none

TLC, the TLA+ model checker. A spec with no graph beside it is followed by TLC traces: TLC judges every step the runs took, and without it the pass says the steps weren't checked. A failure to follow a spec runs it on the state the code reached, so it says which of the spec's invariants hold there; without it, that they weren't checked.

PROPTASTIC_STATISTICS

Java system property
proptastic.statistics
Takes
on, true or 1
Default
off

Whether a passing property prints what classify counted. A failure always prints it.

PROPTASTIC_COLOR

Java system property
proptastic.color
Takes
auto, always or never
Default
auto

Whether what proptastic prints is in colour. auto colours it where colour is rendered and kept out of files: the test's own terminal and IntelliJ IDEA's test runner, and anywhere FORCE_COLOR is set. Never with NO_COLOR set or TERM=dumb, nor for an agent or mutastic. Gradle and Maven write a test's output into their reports too, where colour shows as ?[1;31m, so auto leaves them plain: always colours their console, and their reports with it.

PROPTASTIC_EXPLAIN

Java system property
proptastic.explain
Takes
1, true or on
Default
off

Prints the long form under each how sure: line a pass prints: how many tries or runs were counted, how the bound is worked out, and what "drawn this way" covers and doesn't. Either way, the first such line in a run points to the guide that explains it.

PROPTASTIC_AGENT

Java system property
proptastic.agent
Takes
1, true or on
Default
off

Prints a failure for a coding agent to read: the verdict and the rules first, then the report inside a fence that marks it as data.

PROPTASTIC_COMMANDS

Java system property
proptastic.commands
Takes
proptastic, or a build plugin's command and its option prefix
Default
the build's own commands

Which commands a failure's rerun: line is written in. The proptastic CLI sets it to proptastic on every build it starts, so a failure reruns as proptastic run --only='…' --seed=0x…, which works on any build as typed. The Gradle and Maven plugins set their own command, ./gradlew proptasticRun -Pproptastic. or ./mvnw proptastic:run -Dproptastic., so it reruns as ./gradlew proptasticRun -Pproptastic.only='…' -Pproptastic.seed=0x…. Any other value leaves the build's own command, such as ./gradlew test --tests '…'.

PROPTASTIC_EVENTS

Java system property
proptastic.events
Takes
false turns it off
Default
on

Whether each property writes its event file, in events/, and its line in properties.json. mutastic turns it off while it runs your properties against changed copies of your code (see For measuring), so those runs don't overwrite the results of yours.

You won’t need these. They’re for measuring proptastic itself, and for tools that run your properties many times over, such as mutastic, which sets them on its own runs.

That kind of tool does mutation testing, which checks your tests rather than your code. It makes small deliberate changes to the code, each one a mutant: a < turned into <=, say, or a line removed. Then it runs your tests and properties against each mutant. If one fails, it caught the mutant, as it would catch that bug. If they all pass, they missed a change they should have noticed. Since mutastic runs your properties once for every mutant, it turns off what those runs don’t need, and can record which saved inputs catch which mutants.

PROPTASTIC_LOG

Java system property
proptastic.log
Takes
a file
Default
none

Appends a tab-separated line to the file for each property run.

PROPTASTIC_MUTANT

Java system property
proptastic.mutant
Takes
a mutant's id
Default
none

Which mutant this run is testing: the id of one deliberately changed copy of your code (see For measuring), for PROPTASTIC_CORPUS_MATRIX. mutastic sets it.

PROPTASTIC_CORPUS_MATRIX

Java system property
proptastic.corpus.matrix
Takes
a file
Default
none

When a run is testing a mutant, appends to the file whether each corpus entry caught it, so you can see which saved inputs find which bugs. mutastic sets it.

These are fixed: no setting changes them, except where the line says.

WhatHow many
Tries a property makes unless it says100
Random tries in the pr profile, after the corpus10
Times each property's tries, in the nightly profile10
The most runs shrinking spends on one counterexample2,000
Width a failure's line may reach, unless COLUMNS says100
The narrowest width COLUMNS can set40

COLUMNS is the terminal’s own variable, not proptastic’s. A failure’s facts stay one to a line while each fits in that width. When one doesn’t, or a value spans lines, every value goes on the line below its key.

Privacy