Book
Property-Based Testing with PropEr, Erlang, and Elixir
Fred Hebert
Summary
Fred Hebert shifts the unit of testing from an example to an invariant: instead of asserting what a function returns for one specific input, PropEr generates hundreds of random inputs and checks that a property holds for all of them, then shrinks any failing case down to the smallest input that still breaks it. Built around Erlang and Elixir, the book moves from writing basic properties and custom generators through targeted and stateful property testing, closing with a case study that models a book lending system as a finite state machine and tests it against that model. The shrinking mechanism is the book's throughline: it's what turns a random failing input into a minimal, debuggable one.
Target Readers
- Erlang and Elixir developers who write example-based tests and want to find edge cases their examples don't cover
- Engineers testing stateful systems who need a model-based approach beyond asserting individual input-output pairs
- Developers curious about property-based testing's core mechanism, generation and shrinking, who want it taught with a real language rather than in the abstract
Tags
Colophon
- Publisher
- ラムダノート
- ISBN
- 978-4908686184
- Published
- Nov 2023
- List price
- ¥4,950incl. taxMay differ from the actual selling price on Amazon
Get this book
* The link above is an advertisement via Amazon Associates.Related Books
Prerequisites
- Recommended
Effective Software Testing
A developer's guide
Maurício Aniche
Reason: Once example-based testing techniques are in hand, you advance to property-based testing, which generates inputs broadly and verifies invariants. You let the machine find counterexamples a human would miss and expose gaps in the spec.