Property-based testing: work harder, not smarter

Property-based testing: work harder, not smarter

Testing is an important part of software development, but how many tests is enough? Should you write a test for every possible value that could be submitted to a function? Property-based testing is a technique that can help you with this conundrum. Instead of writing a specific set of tests, write some generalized tests and let a tool randomly test inputs against your code.

I'll explain in more detail what property-based testing is, how it works, and show some practical examples using Eris, a new PHPUnit extension modeled after Haskell's QuickCheck library.

2fe1b2866cfd498a513295d60d5cad0f?s=128

Joel Clermont

November 07, 2015
Tweet