Wrapping Up

Here's a summary of what we learned in this chapter.

We'll cover the following

Summary

In this chapter, we’ve seen multiple ways to come up with properties. We’ve been over modeling our system with simpler or alternative implementation and checking that they both work the same, and we’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 should represent a decent starting point if we’re unsure how to get going.

What’s next

We’ll have plenty of chances to put these ideas into practice. But we’ll soon see that some properties are hard to test with just the default generators. If we want to focus on behavior for a specific class of input, then very broad generators are not the best method. In the next chapter, we’ll see how to efficiently drill down into the data generation phase of properties, improving our tests with custom generators.

Get hands-on with 1200+ tech skills courses.