Testing comparisons

Stateful vs. stateless property-based testing

Decide whether one input or a sequence exposes a booking bug. Use an independent seat model and preserve the operation order that caused a failure.

Does the fault depend on the order of operations or a single input value?

Start with stateless properties when each input and result can be evaluated on their own. Use stateful property testing when valid actions and expected results depend on earlier operations. The extra work pays off when a short, unexpected history can expose a defect that one isolated call cannot reach.

Use a tiny independent booking model

Give a room one seat. The reference model holds either no booking or one active booking ID. Reserve, cancel that booking, then reserve again. At each step compare the visible capacity and active bookings with the model. Keep the model simpler than the implementation so it does not reproduce its storage or caching mistakes.

Stateful vs. stateless property-based testing
RequirementStateless propertyStateful property
Price is non-negativeGenerate a seat price and calculate its fee.A history adds little to this isolated rule.
Capacity never falls below zeroTest a supplied snapshot with a known capacity.Check the invariant after every generated operation.
Cancelling restores a seatSupply an explicit before-and-after fixture.Cancel a reservation previously produced in the same run.
Replay a failureSave the input and expected value.Save initial state, ordered operations and divergence.

Save the sequence as well as its inputs

Generate only actions that make sense in the current state, or define the product’s expected response to an invalid action. Reset the target between generated histories. If a failure shrinks to “reserve A, cancel A, reserve B”, store that sequence, initial state and first differing observation. A single request for B cannot explain the stale reservation.

Primary documentation

Your next release starts here

Keep building.
Put testing to work.

Give Cue April your next testing challenge. Let your AI quality lead coordinate the checks, so your team can focus on what comes next.

Create account

Create your account, connect a repository and review your proposed setup before approving a run.