Property Based Testing: From Theory to Practice
summary
Property-based testing is presented using the JavaScript fast-check library to generate hundreds of inputs per property, run tests (e.g., 100 runs), and automatically shrink failures to minimal counterexamples. A concrete example applies generators to test a diff algorithm: generators produce random diff candidates, the test reconstructs original texts, runs the diff function, and asserts the result contains the target text and has no more lines than the candidate. The approach finds real bugs and edge cases (Jest/Jasmine/React regressions, oversized strings) at the cost of increased execution time but with small, actionable failing cases.
AI-written summary · about
chapters (6)
- 0:00Introduction
- 5:10Speaker background
- 9:06What is property based testing
- 12:57Example with diffs
- 23:19Applications and limits
- 26:07Q&A
related talks
51mProperty-Based Testing
47mProperty-Based Testing
46mProperty-based testing:You won't look at your tests the same way ever again
36mProperty Based Testing: From Theory to Practice
30mProperty-based Testing for Godly Tests
36mProperty-Based Testing: Unveiling the Truth on Test Reduction
45mProperty based tests for the masses
23mProperty based testing is a mindset
