How-to guide

How to design boundary value tests

Which values should I test around an inclusive limit?

Test the limit itself and the nearest meaningful values on either side. For a bounded range, do this at both ends, choose a typical value inside the range and state the expected result for each case.

Turn a rule into a set of cases

Start by checking the unit, allowed precision and whether each endpoint is included. An integer count and a continuous measurement have different neighbours.

  1. Group inputs by the behaviour you expect, such as below range, within range and above range.
  2. Choose the boundary and its adjacent representable values. Hold other inputs steady so each failure identifies a specific decision.
  3. List the observable result and side effects for each value. Treat missing inputs and wrong types as separate classes if the interface can receive them.

Worked example

A workshop accepts groups of two to eight

For whole-person bookings, try 1, 2, 3 and 7, 8, 9, plus an ordinary group of 5. The counts 1 and 9 should show a size error and create no reservation. The other counts should create a reservation for exactly that many places. A successful case at 5 alone would miss either off-by-one error.

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