Less Boring Tests - An Introduction to Property-Based Testing
summary
Property-based testing is shown using FsCheck with xUnit to generate hundreds of inputs (default run tries 100 randomized cases) and it immediately finds a bug in existing tests. Concrete examples include a FizzBuzz spec that uncovers failures for 6 and 0 and a generator that creates todos, lets the database assign IDs, then deletes a created todo to test a non-existent ID. Shrinking reduces failures to minimal counterexamples; seed and size parameters make failures reproducible.
AI-written summary · about
chapters (12)
- 0:00Introduction to talk
- 1:53Boring example-based tests
- 6:02Property-based testing basics
- 10:40FizzBuzz property-based test
- 18:51Test execution and seeds
- 23:09Custom generators for complex types
- 27:23Types of properties to test
- 32:49Shrinkers and failure minimization
- 34:57Limitations of property-based testing
- 36:42Library recommendations
- 37:47Acknowledgements and references
- 38:51Q&A session
