Generalizing Test Examples
Learn how to transform specific unit test examples into generalized property-based tests by using data generators. Understand strategies to model test properties for functions, increase test coverage, and decide which components to trust in your testing approach.
We'll cover the following...
Generalizing test examples
Modeling tends to work well, as long as it is possible to write the same program multiple times, and as long as one of the implementations is so simple, it is obviously correct. This is not always practical, and sometimes not possible so we need to find better properties. That’s significantly harder than finding any one property, which can already prove difficult and requires a solid understanding of the problem space.
Note: A good trick for finding property is to start by writing a regular unit test and then ...