Search⌘ K
AI Features

Resizing Generators

Discover how resizing generators help gradually increase test data size and complexity in property-based testing using PropEr. Learn to use the resize function and ?SIZED macro to scale data effectively, ensuring thorough edge case coverage and balanced test input generation.

What is resizing?

Resizing is the process that makes generators grow bigger:

  • Make an integer larger.
  • Make a list longer.
  • Make a string have larger codepoints.

This is the simplest thing to do with custom generators.

In fact, PropEr makes that happen for us on its own as the tests run. The way generator growth works is that PropEr internally uses a size parameter. Its value is usually small at first, but as tests run, the value is increased, and the data generated grows in complexity along with it. This allows the framework to start testing our systems with initially small data, and to then progressively make it more complex.

Resizing is part of a ...