Property-Based Testing: Catching the Bugs You're Missing
CampJS, 2016
Writing code well is hard enough; testing code well is much harder. We cherry-pick our test examples piecemeal, hoping to cover all the bases, and our apps still blow up.
A testing approach called Property-Based Testing lets you lean on the computer to help you write better, more thorough tests. What are property tests, what are they good for, and how do you write them? Come along and learn how to make the your tests really work for you.
This is a retooled version of a property-based testing talk I’ve previously given (at a Sydney Railscamp and the Sydney Ruby meetup); I’m considering this the last version of this talk, and probably won’t give it again.
(There are a couple of silly errors that I’ve since fixed in the slides PDF, eg. add(-1,0) === 1
showing up near the bottom of the screen, but they’re not major. 😅 )
Big thanks to @strawz for recording the video for this and so many of the other CampJS talks. Credit for the breakdown of different “kinds” of properties goes to these blog posts / materials: