Skip to content

Profiles and budgets

How many tries a property deserves depends on where it runs. On your machine you want a quick answer; on a pull request, a check that’s fast and repeatable; overnight, as long a search as there’s time for. A profile says which, for a whole run, without changing a test.

Set one with PROPTASTIC_PROFILE:

Profile What a run does
local, the default each property’s own tries: .tries(…), else 100
pr every corpus entry, then 10 random tries, whatever the property says
nightly 10 times each property’s tries, and adds each counterexample to the corpus

pr is for a pull request’s checks: the inputs that found bugs before always run, and a few new ones, so it stays fast. nightly is for a scheduled run with time to spend, and keeps what it finds for every run after it. PROPTASTIC_TRIES wins over any profile, and over every property’s .tries(…).

PROPTASTIC_BUDGET=2s gives each property at most two seconds of trying, written 500ms, 2s, 1m, 1h, or ISO-8601’s PT2S. When a property’s budget runs out it passes, and prints how many of its tries it made, so a pass that checked fewer than it meant to says so. A failure found before then is a failure as any other.

A budget suits a run with a deadline, such as a pull request with a time limit, where a slow property shouldn’t hold up the rest.

Settings has every setting a run reads, each with its Gradle and Maven form.

Privacy