Wrapping Up

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

We'll cover the following

Summary

In this chapter, we’ve been through a realistic integration test suite written as stateful properties. We began with a model layer with no tests for a bookstore using a PostgreSQL instance. We first started by drawing up the generators for our base data types, which helps do some broader testing to make sure the system works without throwing exceptions. That’s where we encountered and resolved our first encoding bug.

With this out of the way, we established the initial model, using a wrapper module (a shim) to allow as much determinism as possible. As we’ve seen, this approach tends to create a bit more repetition with precondition-heavy code, but makes tests more decidable and simpler to debug. We’ve also seen this at work as we refined the model through multiple failures and discovered more tricky aspects of using SQL.

Additionally, we’ve been through a round of debugging, and we’ve seen how PropEr shrinks stateful property command sequences to debug our models before doing a final check with parallel tests.

What’s next

With this, we’ve seen most of what there is to see with stateful properties. The one exception is a specialization for systems that represent finite state machines, which we’ll get to next.

Get hands-on with 1400+ tech skills courses.