Search⌘ K
AI Features

Generalizing Test Examples

Explore how to generalize test examples by transforming unit tests into properties in property-based testing. Understand modeling techniques, generator usage, and how to abstract common steps for effective test coverage using PropEr in Erlang.

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 a property is to start by writing a regular unit test and then abstract it away. We can take the common steps to come up with all ...