Property-Based Testing
summary
Property-based testing uses concrete properties (for all X satisfying preconditions some predicate holds) and generators to find edge cases automatically, running FSCheck (defaults to ~100 inputs and shrinking to a minimal failing case) against code like list reverse, random-element removal, custom serializers, or refactor comparisons. A real codebase example grows FSCheck references from 74 to 129 (≈50% increase) and found issues even in JS tooling via fast-check (e.g. strict equality edge cases), making it easy to catch runtime exceptions and subtle logic errors.
AI-written summary · about
chapters (17)
- 0:00Introduction
- 2:05What is property-based testing
- 7:58Unit tests vs list reversal
- 12:46How property-based testing works with FsCheck
- 18:25Five practical scenarios
- 24:30Serializer testing
- 25:53Finding exceptions
- 26:33Valid output ranges
- 27:36Real-world adoption
- 30:52Complex type support
- 34:52FsCheck with C#
- 35:13Performance implications
- 37:18Compiler vs runtime errors
- 41:14Testing pyramid placement
- 42:40Early error catching
- 44:02When not to use
- 46:30Conclusion
related talks
51mProperty-Based Testing
30mProperty Based Testing: From Theory to Practice
36mProperty-Based Testing: Unveiling the Truth on Test Reduction
23mProperty based testing is a mindset
45mProperty based tests for the masses
46mProperty-based testing:You won't look at your tests the same way ever again
30mProperty-based Testing for Godly Tests
58mProperty Based Testing: Concepts and Examples
