Property Based Testing with Hypothesis: Stronger Tests, Less Work
summary
Shows how Python’s Hypothesis generates hundreds of randomized cases, shrinking failures to minimal examples, and finds real bugs in a small CRUD app by running random sequences of HTTP actions against a simple state model. Demonstrates a sorting property (output ordered and same multiset), then a stateful testing setup that caught an ID/override bug where adding a book with the same title replaces the old one and a delete-then-update sequence that resurrects a record. Tests are compact (dozens of lines), runnable with a few hours’ setup, and reliably expose whole categories of lifecycle bugs.
AI-written summary · about
chapters (6)
- 0:00Introduction to property based testing
- 2:13Testing a sorting function
- 11:31Stateful API testing with state machine
- 27:47Bug categories and testing ROI
- 30:38Challenges in property based testing
- 37:19Getting started with Hypothesis
related talks
41mProperty Based Testing in Python with Hypothesis
50mProperty based testing with Hypothesis
27mTesting Beyond Examples: Property Based Testing with Hypothesis
27mHypothesis: Simpler Powerful Test Cases
40mProperty-based Thinking
32mTest faster, fix more
26mProperty Based Testing the Python Way
01h 31mIntroduction to Property-Based Testing
