Property-Based Testing
Asserting a general property that should hold for all inputs, then letting the framework generate many random inputs to try to break it.
Property-based testing flips the usual test-writing direction: instead of picking a specific input and asserting a specific expected output, the developer states a property that should hold across a whole class of inputs — "sorting a list twice gives the same result as sorting it once," "encoding then decoding returns the original value" — and the testing framework generates hundreds or thousands of random inputs to try to find one that violates it. QuickCheck (Haskell, 1999) originated the idea, and it's since been ported to nearly every language (fast-check for JS/TS, Hypothesis for Python, jqwik for Java).
The value over a hand-written Unit Test is coverage of the input space a human wouldn't think to write by hand — empty lists, deeply nested structures, unicode edge cases, numbers at overflow boundaries — because the generator explores the space mechanically rather than relying on a person's intuition for which few examples matter. When a generated input fails the property, most frameworks then "shrink" it: repeatedly simplify the failing input while it still fails, so instead of a report saying "this 4,000-element list with these specific values broke it," the framework hands back the smallest failing case it can find, often a two- or three-element list — turning an unreadable counterexample into a debuggable one.
The hard part is the one the technique's name is honest about: finding a property that's both true and non-trivial. "The function doesn't crash" is a property but a weak one; "output length equals input length" is stronger and easier to falsify accidentally, which is exactly what makes it worth checking. Properties are also naturally suited to catching the kind of bug a fixed example-based Unit Test suite structurally can't — one that only shows up for inputs nobody thought to write down — which is why property-based testing tends to pair with, rather than replace, a normal suite of specific example tests for documented behavior and known edge cases.
See also5
Mutation Testing
A test-of-tests that injects small bugs into code and checks whether the existing suite catches them, exposing tests that assert nothing.
Testing & Verification9 connections
Assertion
The statement in a test that must hold, and the only part that can actually fail.
Testing & Verification19 connections
Test Fixture
The prepared data or state a test runs against.
Testing & Verification16 connections
Design by Contract
Specifying what each function requires and guarantees, as checkable preconditions, postconditions, and invariants, so a violation says exactly whose bug it is.
Testing & Verification12 connections
Parameterized Test
Running one test body against a table of inputs and expected outputs, so each case is a single readable row and each failure is reported on its own.
Testing & Verification7 connections
Linked from8
- Design by ContractTesting & Verification
Specifying what each function requires and guarantees, as checkable preconditions, postconditions, and invariants, so a violation says exactly whose bug it is.
- Minimal Reproducible ExampleTesting & Verification
The smallest self-contained program or set of steps that still shows a bug, and why making one is often the moment the bug gets understood.
- Parameterized TestTesting & Verification
Running one test body against a table of inputs and expected outputs, so each case is a single readable row and each failure is reported on its own.
- Pseudorandom Number GeneratorComputation & Algorithms
An algorithm that produces a sequence of numbers that looks random but is fully determined by a starting seed, and the separate, stricter kind needed for security.
- Static AnalysisTesting & Verification
Finding bugs by examining code without running it, from linters and type checkers to deep security analysis, always trading missed bugs against false alarms.
- Test Data BuilderTesting & Verification
Helpers that build valid test objects from sensible defaults so each test states only the fields it cares about, and the Object Mother pattern they grew out of.
- Test OracleTesting & Verification
Whatever decides whether a test's output is correct, and the often-overlooked hard part of testing when nobody knows the right answer in advance.
- Unit TestTesting & Verification
A fast, isolated test of one unit of behavior with its collaborators replaced.