🧪Property-Based Testing
Go beyond example-based tests — learn to express what your code should always do, then let a framework find the inputs that break it.
Phase 1What Properties Really Are
From examples to universal claims about your code
One property beats a hundred examples
6 minOne property beats a hundred examples
Five patterns that cover most properties
7 minFive patterns that cover most properties
Your framework already generates the inputs
7 minYour framework already generates the inputs
Stop thinking in test cases, start thinking in contracts
6 minStop thinking in test cases, start thinking in contracts
Phase 2Properties for Pure Functions
Write real properties for pure functions
Encode, decode, and get back where you started
7 minEncode, decode, and get back where you started
What doesn't change tells you what the function really does
7 minWhat doesn't change tells you what the function really does
Test your fast code against your slow code
7 minTest your fast code against your slow code
Your function might already obey algebraic laws
7 minYour function might already obey algebraic laws
Small properties compose into strong specifications
6 minSmall properties compose into strong specifications
Phase 3Generators, Shrinking, and State
Generators, shrinking, and stateful models
When random strings waste your testing budget
7 minWhen random strings waste your testing budget
47 elements found the bug, but only 3 mattered
7 min47 elements found the bug, but only 3 mattered
Your API has state — and property testing can model it
8 minYour API has state — and property testing can model it
Your team says property tests are too slow for CI
7 minYour team says property tests are too slow for CI
Phase 4Find a Real Bug
Find a real bug with property tests
Property-test a real module and find what's hiding
8 minProperty-test a real module and find what's hiding
Frequently asked questions
- How do I think of good properties?
- This is covered in the “Property-Based Testing” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
- What is shrinking?
- This is covered in the “Property-Based Testing” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
- When are example tests still better?
- This is covered in the “Property-Based Testing” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
- Does property testing replace unit tests?
- This is covered in the “Property-Based Testing” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
Related paths
🐍Python Decorators Introduction
Build one mental model for Python decorators that covers closures, argument passing, functools.wraps, and stacking — then ship a working caching or logging decorator from scratch in under 30 lines.
🦀Rust Lifetimes Explained
Stop reading `'a` as line noise and start reading it as scope arithmetic — one failing snippet at a time — until you can thread lifetimes through a small parser or iterator adapter without fighting the borrow checker.
☸️Kubernetes Core Concepts
Stop drowning in 30+ resource types. Build the mental model one primitive at a time -- pods, deployments, services, ingress, config -- then deploy a real app with rolling updates and health checks.
📈Big O Intuition
Stop treating Big O as math you memorized for an interview — build the intuition to spot O(n²) disasters, pick the right data structure without thinking, and rewrite a slow function from O(n²) to O(n) in under five minutes.