Default Generators
Get introduced to generators and take a look at a few default generators provided by PropEr.
We'll cover the following
Generators
Generators are a huge part of where a property-based testing framework’s magic comes from. While developers do the hard work of coming up with properties, the efficiency with which they will be exercised depends on what kind of inputs will be passed to them. A framework with inadequate generators is not a useful framework, and great generators will directly impact how much trust you can put into our tests.
Generators are functions that contain a bunch of internal parameters that direct their randomness, how the data they create gets more or less complex, and information about other generators that can be used as parameters. We don’t need to know how their internals work to use them; from our point of view, they’re just functions that can be combined. However, being familiar with what data they can generate is important since it lets us create all the kinds of Erlang data we might need. You’ll likely even want to use generators outside of a testing context because they are just that nifty.
Get hands-on with 1400+ tech skills courses.