Property Based Developer Testing
From CitconWiki
Jump to navigationJump to searchThe printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Session at CITCONNA2013Sessions
Proposed by Paul Holser
- Amounts to adding "for-all" style assertions about a function to some "there-exists" style tests.
- Works best on already-TDD'ed code. TDD builds up designs example by example. Hard to see the "for-all" statements without data point to triangulate from.
- Agitar does something similar -- execute code using lots of different kinds of inputs, possibly deriving interesting data points by inspecting the test subject itself...
- Works well on already "math-y" domains
- Drives you, if you're paying attention, away from Primitive Obsession and modeling things like SKUs, Prices, SSNs, etc. as first-class concepts. Otherwise generators miss too much, or try to create invalid things.
Literature
- Property Based TDD at SPA 2013
- The Practice of Theories: Adding "For-all" Statements to "There-exists" tests
- Property based testing for domain models
- Property-based testing: What is it?
- Real World Haskell: testing and quality assurance
- Beyond xUnit exampled-based testing: property-based testing with ScalaCheck
- Property-Based Testing Tools
- Theory-infected: Or How I Learned to Stop Worrying and Love Universal Quantification