Email the Author
You can use this page to email Willem van den Ende about The (Little) QuickCheck Workbook.
About the Book
This is an in-progress book, we've just field-tested the first exercises. We don't know how big it's going to be, we currently guess around 70 to a 100 pages when finished. Get the book, give feedback and influence what it will be :-).
Although the QuickCheck library has been around since 2000, and has more recently been ported to several other languages, we believe more teams could benefit from using it in anger.
We've been doing example based testing since 1999, and believe property-based testing is a valuable and fun addition to our toolbag. Property-based testing also influences our design, and writing this book is a way to explore how our designs are influenced.
Example based approaches like BDD and TDD focus on what changes. Given we have state x, When event y happens we'll have state z.
Property based testing forces you to think about things that stay the same: invariant properties of your code, and forces you to capture these invariants explicitly.
Although the QuickCheck library has been around since 2000, and has more recently been ported to several other languages, we believe more teams could benefit from using it in anger.
We've been doing example based testing since 1999, and believe property-based testing is a valuable and fun addition to our toolbag. Property-based testing also influences our design, and writing this book is a way to explore how our designs are influenced.
Example based approaches like BDD and TDD focus on what changes. Given we have state x, When event y happens we'll have state z.
Property based testing forces you to think about things that stay the same: invariant properties of your code, and forces you to capture these invariants explicitly.
Benefits
- Understand existing libraries, quickly test a wide range of cases (e.g. numeric types or libraries to represent money) or legacy code.
- Test validation logic with very good test/code ratio.
- Test mappings / adapters / marshalling. Properties let us easily exploit symmetries between input and output here.
- Find pesky corner cases
- Find out why a regular unit tests sometimes passes, and sometimes doesn't (flickering tests)
How does Property Based Testing work?
- you define properties - invariants of the system-under-test
- the property based testing library generate lots of random input data
- the system under test is run with this input data and the testing library verifies that the invariants hold under all inputs.
There are many implementations of QuickCheck, but the original one is in Haskell. We chose to write this book with Haskell to experience it at the source. Some knowledge of Haskell is required, but not too much - we've tested some of the material at a conference and it seemed to work for people who don't use Haskell in their day job. We'll incorporate your feedback so we can make it as approachable as possible.
Open the book, flex your property-writing muscles, have fun and profit!
About the Author
Willem created his first legacy software aged 16, and has been looking for better ways of developing software since then. He's been doing and teaching Test Driven Development since 2000.