Writing bulletproof code with property-based testing
summary
Shows how property-based tests replace hand-picked cases with 1,000 semi-random examples by default and catches bugs missed by examples (uppercase-regex error found). Demonstrates jqwik and Kotest, jqwik’s shrinking to a minimal counterexample and seed-based reproducibility, and builds a stateful test for a text editor that simulates random sequences of edits/undo/redo (limits: 20 undos) to verify invariants. Notes tradeoffs: harder to find properties and slower runs, best for utility logic and edge-case coverage.
AI-written summary · about
chapters (11)
- 0:00Introduction to testing
- 1:56Example based testing explained
- 8:04Problems with example tests
- 9:05Property based testing intro
- 13:21Choosing a PBT framework
- 14:03Writing first property test
- 16:31Understanding jQuick reports
- 20:03Edge cases and shrinking
- 21:49Stateful testing explained
- 31:09Pros and cons of PBT
- 39:23When to use property tests
related talks
21mProperty-based testing - let your testing library work for you
58mProperty Based Testing: Concepts and Examples
45mProperty based tests for the masses
51mProperty-Based Testing
30mProperty Based Testing: From Theory to Practice
46mProperty-based testing:You won't look at your tests the same way ever again
54mAn Introduction to Property-based Testing
26mThe missing piece of testing
