dcreager.net

Property-based testing

Property-based testing is a way of testing software by generating large numbers of random but structured inputs, and verifying that certain properties hold for each input. It is not an exhaustive search, since it presumably would take far too long to enumerate all possible inputs. But it's helpful for finding interesting classes of inputs, and corner cases, automatically.

Property-based testing libraries will typically “minimize” an input when it fails, trying to find the “smallest” input that also fails. You have some amount of control over what is considered “smaller” based on how you construct the inputs. This can help narrow down which part of the code is broken.

CSP would be a good language for property tests

Libraries

Hypothesis [Python]

QuickCheck [Haskell]

QuickCheck [Rust]

proptest [Rust]

Rapid [Go]

Theft [C]

Papers

[Krook2023] QuickerCheck: Implementing and Evaluating a Parallel Run-Time for QuickCheck