Wrapping Up

In this chapter, you’ve seen multiple ways to come up with properties. We’ve been over modeling our system with a simpler or alternative implementation and checking that they both work the same, and you’ve seen how example tests could be generalized to the point where their creation is automated. We’ve also looked at how multiple small invariants can be put together to make a test more solid, and finished up with some symmetric properties. For most properties, any of these four approaches will represent a decent starting point if you’re unsure how to get going.

We’ll have plenty of chances to put these ideas into practice. But you’ll soon see that some properties are hard to test with just the default generators: if you want to focus ...

Get Property-Based Testing with PropEr, Erlang, and Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.