Search⌘ K

Writing Generators

Explore how to create and validate custom data generators essential for stateful property-based testing in Elixir. Understand the role of generators for titles, authors, and ISBNs within a bookstore system to better simulate valid and invalid states during testing.

Getting started

Since we have a fairly large stateful system to validate, we should start by figuring out what data the system should accept, and what is valid and invalid. This is useful because it sets a baseline for expectations on which to build. It can also hint at useful paths or strategies moving forward. We’ve got a basic idea about the shape of data based on our database schema.

The generators

We’ll have a total of three generators for the initial testing of the application. They are as follows:

  • Title.
...