Explanation

What a characterisation test can tell you

Does a characterisation test establish that legacy behaviour is correct?

A characterisation test captures a system’s observed behaviour on chosen inputs. It can reveal a behavioural change during a refactor. Establishing that the behaviour is correct also requires a requirement, rule or independently reviewed example.

Why capture a result you cannot yet justify?

A legacy component may have users who depend on undocumented details. Recording a representative set of outputs at a stable interface makes a refactor easier to review. Label the build, fixture and reason for capturing each expectation so its origin remains visible.

How does an observation become a requirement?

Ask someone responsible for the behaviour to review the example. If they confirm the expectation, record its rationale and make it an explicit rule. If they identify a defect, keep the evidence of the old behaviour and write a new check for the agreed correction.

Worked example

An old importer drops blank lines

A characterisation case shows that a blank line between two catalogue items disappears during import. It can flag a refactor that starts creating an empty item. The catalogue owner can then explain whether blank lines should be ignored, rejected with a message or preserved.

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