Chapter 2 of 6

Agree what a correct result looks like

How do you establish an expected result before writing a test?

Turn the risk into a concrete example with a starting state, an action and an observable outcome. Ask the person who owns the rule to resolve ambiguous cases, then keep their decision alongside the test as its oracle.

Get the difficult example agreed

A tester, developer and product owner can often agree on the everyday case in a minute. Spend the discussion on the case where two reasonable readers predict different results.

  1. Write a typical example with real units and a measurable outcome.
  2. Change one detail that might reverse the decision. Ask each person to predict what the user sees and what is saved.
  3. Record the agreed outcome, its source and any remaining question. If a decision is pending, preserve both interpretations and give the question an owner.

Make the agreement usable

Give each example a name. Record the relevant clock, precision and meaning of a deadline if time is involved. A future reader should be able to decide whether an observed result is correct without reading the implementation.

Worked example

Does the hold include the last second?

The booking owner agrees that a hold started at 09:00:00 expires at 09:10:00 on the service clock. The service records confirmation at whole-second precision. At 09:09:59 it should confirm the seat. At 09:10:00 it should decline the confirmation and leave the seat available. The screen countdown reminds the visitor. The service decides whether the request arrived in time.

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