Property-Based Testing for Better Code
Have you ever been stymied in your refactoring by all the test cases you'd have to update? Or read a test and thought, "But WHY that particular result?" Or been bitten in production by a corner case? It always seems like there are too many tests, too few, or both.
Functional thinking to the rescue! In FP, we like to figure out what our code does in all circumstances, not only a few. The verification side of this is Property-Based Testing, and the framework is ScalaCheck.
Come learn the charm of autogenerated test data, the beauty of expressing only what matters, and the challenge of stating what you need without repeating the code under test. Property-based testing isn't only for more tests with less code. It's about constraining your implementation in all the ways that matter and fewer of the ways that don't. These tests can help your software evolve: maximize correctness without hindering flexibility. When 1 test is 100 tests, the number is always just right.