Property-based Thinking
summary
Demonstrates using property-based testing with Hypothesis (Python) to write invariants instead of example-only tests, generating 100 generated examples of lists to inspect distributions (the run shows ~86% unique lists, 12% duplicates) and catching a NaN-sort case. Builds a stateful model with a rule-based state machine for a counter, reproduces the exact transition sequence that breaks the invariant (decrement below zero, and later exceeding a 20 limit), and shows iterating generators and assertions until the model matches domain reality.
AI-written summary · about
chapters (13)
- 0:00Property-based thinking
- 1:02Property-based testing
- 3:07Problem to software changes
- 9:50Testing by example falls short
- 13:40Properties and invariants
- 16:32Property-based test model
- 21:29Floats and edge cases
- 23:36Lessons from property-based testing
- 26:39Stateful models and state machines
- 33:04Challenges and benefits
- 37:00Complementary tool
- 38:26Happy paths and edge cases
- 39:11Closing thoughts
related talks
27mTesting Beyond Examples: Property Based Testing with Hypothesis
50mProperty based testing with Hypothesis
41mProperty Based Testing with Hypothesis: Stronger Tests, Less Work
41mProperty Based Testing in Python with Hypothesis
01h 24mIntroduction to Property Based Testing
01h 23mIntroduction to Property-Based Testing
26mProperty Based Testing the Python Way
01h 31mIntroduction to Property-Based Testing
