# What does a generator do in a property test?

> A test data generator chooses inputs for a property test. An appointment example shows how to produce valid intervals, date boundaries and invalid cases.

Source: https://cueapril.com/knowledge/definitions/test-data-generator
Updated: 2026-12-02
Index: https://cueapril.com/llms.txt

## What does a generator do in a property test?

A test data generator describes how to produce inputs for a property test. Its choices determine which shapes, ranges and combinations the property can encounter. Generators can deliberately produce valid inputs, invalid inputs or both, depending on the behaviour being checked.

## How can you tell which cases the generator exercises?

Inspect samples and count the categories that actually reach the assertion. Discarding most draws can hide a poor fit between the generator and the rule. Build valid structures from their parts and choose important boundaries explicitly so unusual cases receive enough attention.

## Worked example: Generating appointments that cross a date boundary

For a valid appointment interval, generate a start time and a positive duration, then derive its end time. Include starts just before midnight. Use a separate set of reversed intervals to check the validation message for an end time before the start.

## Try it on your pull request

Choose a change in your repository and tell Cue April what should happen. Review the proposed checks before they run.

[Try Cue April on your repository](https://app.cueapril.com/sign-up/?next=%2Fquality-start)

## Related reading

- [How to write and replay a property-based test](https://cueapril.com/knowledge/how-to/write-a-property-test)

- [Shrinking](https://cueapril.com/knowledge/definitions/shrinking)

- [Boundary value analysis](https://cueapril.com/knowledge/definitions/boundary-value-analysis)

[Browse the Knowledge base](https://cueapril.com/knowledge)
