Wrapping Up
In this chapter, we’ve been through a realistic integration test suite written as stateful properties. All we had was a model layer for a bookstore using a PostgreSQL instance, with no tests in it. 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 you’ve seen, this approach tends to create a bit more repetition with precondition-heavy code, but makes tests more decideable, and simpler to debug. You’ve also seen this at ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access