Property-based testing (PBT) checks general rules about software by generating many inputs and looking for violations. A conventional test asks whether one chosen input produces one expected result; PBT asks whether a property holds across varied inputs, including edge cases a developer might not think to write by hand. section 5.1.3 section 5.2.3
A property states what must remain true as inputs change. Useful kinds include:
- Structural properties, such as preserving a data structure’s length. section 5.2.3
- Idempotency: applying an operation again produces the same result. section 5.2.3
- Commutativity: changing the order of arguments leaves the result unchanged. section 5.2.3
From examples to generated inputs
Instead of checking only that 1 + 1 = 2, define a rule such as “adding two positive numbers produces a larger number” and try it against generated inputs. For a string-processing function, a fuzzing library could generate unusual formats and extreme values to check that the function does not crash. section 5.1.3 section 5.2.3
Fuzzing and PBT overlap: both use randomized inputs. Fuzzing commonly seeks crashes or unexpected behavior; PBT can also check more specific rules about correctness. Neither replaces carefully chosen traditional tests. The difficult, valuable step is choosing properties that express the behavior the software must preserve. section 5.2.3 section 5.2.4
Properties need not stop at individual functions. At an API or system level, they might require balanced financial transactions, retries that create no duplicate transactions, or a specified response-time threshold. Such invariants can catch missed cases and document essential system rules. section 5.2.4










