Files
sisi/verifiers/many-inputs/jqwik.md
T
swaitsandClaude Fable 5.2 2fc1fe9c2d
ci / tests (macos-latest, python 3.11) (push) Canceled after 0s
ci / tests (macos-latest, python 3.13) (push) Canceled after 0s
ci / tests (macos-latest, python 3.9) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.11) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.13) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.9) (push) Canceled after 0s
sisi 0.1.0: a shared rulebook and verification tool for AI coding agents
Contracts with a ladder of checks, an end-of-turn gate, retrospectives and
shared lessons, time-to-delivery measurement, a library of 140 verification
techniques and 20 recipes, personal data kept outside the clone, and
releases with rollback. Standard library only.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 22:29:02 -07:00

3.2 KiB

id, title, answers, rung, section, languages, kinds, cost, detect, ran_here, verified
id title answers rung section languages kinds cost detect ran_here verified
jqwik Property testing on the JVM with jqwik Does this Java or Kotlin code hold its law for generated inputs, and what is the smallest failing sample? 2 many-inputs java, kotlin general, parsing, money, state-machine medium java -version no docs

Use when

  • JVM code has a law that must hold for all inputs and you run tests with Gradle or Maven.
  • You want shrinking, replayable seeds and generators built from annotations.

Do not use when

  • The author asks agents not to use it: since version 1.10 the jqwik user guide has an "Anti-AI Usage Clause" saying "This project is not meant to be used by any “AI” coding agents at all" and adding that the test engine prints a line to stdout on every run telling agents not to use the library; the main JVM alternative is Kotest's property testing (io.kotest:kotest-property, Kotlin API, actively released), and for plain Java junit-quickcheck exists but has had no commits since 2024.
  • You need coverage-guided search for a parser. Use jazzer.
  • The project is locked to JUnit 4 only; jqwik runs as its own JUnit Platform engine.

Set up

Gradle (versions as in the jqwik user guide at the time of writing; check for newer):

testImplementation "net.jqwik:jqwik:1.10.2"
test { useJUnitPlatform { includeEngines 'jqwik' } }

Maven: dependency net.jqwik:jqwik:1.10.2, scope test. Add -parameters to the Java compiler flags so failure reports show argument names.

Minimal example

import net.jqwik.api.*;

class RoundTripProperties {
    static String encode(byte[] b) { return java.util.HexFormat.of().formatHex(b); }
    static byte[] decode(String s) { return java.util.HexFormat.of().parseHex(s); }

    @Property(tries = 1000)
    boolean roundTrips(@ForAll byte[] data) {
        return java.util.Arrays.equals(decode(encode(data)), data);
    }
}

Run

./gradlew test        # or: mvn test

Passing looks like: the build succeeds, exit 0, the test report shows the property with tries = 1000 and no failures. Failure shows Shrunk Sample (N steps) and Original Sample plus a seed; the build exits non-zero. By default the next run tries the failing sample first (afterFailure = SAMPLE_FIRST); jqwik keeps this in a local database file, so check whether your build wipes it. Reproduce explicitly with @Property(seed = "...").

As a contract check

{"id": "prop-round-trip-jvm", "claim": "decode(encode(x)) equals x for generated byte arrays", "kind": "parsing", "rung": 2, "cmd": "./gradlew test --tests 'RoundTripProperties'", "expect": {"exit": 0}, "timeout_s": 900, "tier": "deep"}

What a pass does not prove

  • It samples 1000 tries by default; edge cases (empty, extremes) are favoured but not exhaustive.
  • A fixed seed left in committed code freezes the sample; use whenFixedSeed = FAIL to forbid it.
  • If the engine is not on the test classpath the property is silently never run: confirm the report lists it. Break the code once and see it fail.
  • Not run here (no JDK version is set on this machine). Coordinates, annotations and the shrinking output are from the user guide; the failure-database location was not confirmed.