Changing Probabilities
Explore changing probabilities in custom data generators to tailor test inputs effectively. Understand how to combine techniques like frequency() and oneof() for more realistic and efficient property-based testing in Elixir.
We'll cover the following...
Why is changing probabilities required?
To understand why and when changing probabilities is useful, let’s take a look at an example. Let’s imagine that we have a generator that looks for ISO Latin1 strings which will let us restrict the range of string().
With transforms, filters, and resizes, we can get pretty far in terms of retargeting our generators to do what we want. The latin1 generator shows us something interesting though. The default string() generator has a large search space, and therefore filtering out the unwanted data can be expensive. On the other hand, ...