Data Generation
Let's understand what Data Generators are and how they are beneficial.
One of the design goals of stream_data
is to provide a set of tools for data generation that could also work outside of property-based testing. For example, generating random data can be useful when seeding databases with fake data.
What are data generators?
At the core of data generation are generators. A generator is a data structure that contains logic that stream_data
uses to generate data. Essentially, a generator is like a function that we can call to generate random terms. Let’s start with a simple instance of a generator, StreamData.integer/0
. This generator produces random integers. We can use all the stream_data
generators as Elixir streams since they implement the Enumerable
protocol.
Executable
Get hands-on with 1200+ tech skills courses.