Quickly Checking your Code for Fun & Profit
Laziness is one of Larry Wall’s “three great virtues of a programmer”, but most people probably don’t consider it a virtue when writing tests! Wouldn’t it be great though, if we could write a program that generates our tests for us? As it turns out, we can and should do this using property-based testing. I’ll go through some example testing scenarios in a few popular mobile programming languages, aiming to demonstrate:
- What property-based testing is and why EVERYONE should be using it (not just people coding in functional languages!)
- How generators can quickly & easily come up with more thorough test inputs than a programmer typing in magic numbers
- How to (and how not to) define properties to specify program behaviour
- The genius of shrinkers and why they can save you hours of tedious debugging and questioning your life choices
Attendees will gain a solid & practical understanding of how they can apply property-based testing to their own code, in fashion that is both enjoyable and lucrative.