Awesome Reviewers

Verification · Testing

Property-based tests

Generates inputs and checks invariants that must hold for all of them, then shrinks failures to a minimal case.

Sub-techniques

  • Round-trip properties V1021.001

    decode(encode(x)) == x for serializers and parsers.

  • Model-based properties V1021.002

    Compare the implementation against a simple reference model.

  • Stateful testing V1021.003

    Generate sequences of operations and check invariants after each.

How to build it

  1. Start with round-trip and idempotence properties; they need no oracle.
  2. Persist the failure database so found cases are replayed.
  3. Promote shrunk failures to example tests.

Signals in a repository

  • @given decorators, fc.assert or proptest! macros in tests.
  • .hypothesis/ in .gitignore.