Definition
Property-based testing is a technique where you specify a general property that should always hold true, then let a tool generate many varied inputs to try to break it. Instead of asserting that one specific input yields one specific output, you assert a rule that must hold for every valid input.
For example, rather than testing that reversing one list gives one expected list, you assert that reversing any list twice returns the original list. The framework then throws hundreds of random lists at that claim.
Why it matters
How it works
A property-based test has three parts: a generator that produces random valid inputs, a property that should hold for all of them, and a runner that feeds many inputs through and reports failures. When a counterexample is found, most frameworks perform shrinking, simplifying the failing input down to the smallest version that still breaks the property.
Property-based testing complements example-based tests rather than replacing them. Examples document intent and pin known cases; properties stress the general rule. The hardest part is identifying which invariants of the code are worth stating.