Property Based Testing: Concepts and Examples
summary
Shows concrete PBT with jqwik using @Property/@ForAll to generate ~1000 random cases by default, reports the seed for reproducibility and uses shrinking to reduce failures (example shrinks to [0,1]). Verifies properties like “reverse(reverse(list)) == original,” builds custom generators with Arbitraries (German ZIP five-digit strings), finds real bugs (ChatGPT stream reverse, Caesar-cipher charset/shift limits, Math.abs overflow at Integer.MIN_VALUE, URL encode failures for some charsets), and demonstrates restricting ranges and combining generators for class constructors.
AI-written summary · about
chapters (15)
- 0:00Introduction to jQwik
- 3:07Property testing examples
- 5:40Annotations and workflow
- 8:25Configuring test reports
- 12:04Shrinking and debugging
- 16:09Data generation options
- 18:57Handling Java time types
- 23:19Custom data generators
- 26:58Testing Java records
- 32:47When to use PBT
- 36:56Caesar Cipher case study
- 43:38Boundary condition testing
- 47:40Finding property patterns
- 52:26Testing FizzBuzz
- 55:02Fibonacci and conclusion
related talks
51mProperty-Based Testing
30mProperty Based Testing: From Theory to Practice
46mProperty-based testing:You won't look at your tests the same way ever again
45mProperty based tests for the masses
57mProperty Testing in Java
21mProperty-based testing - let your testing library work for you
43mTesting: Property-based testing - let your testing library work(...)
54mAn Introduction to Property-based Testing
