Legacy code often has no reliable tests, so nobody can say what 'correct' means. A characterization test records what the system does today, right or wrong, so you can tell whether a change altered it.
Steps
- Collect real inputs and the outputs the current system produces.
- Turn them into automated comparisons.
- Include unusual cases: month-end, rounding, empty fields, large values.
- Flag differences for a human decision: bug in the old system, or behaviour to preserve?
AI can help generate candidate test cases from code and logs. A person still decides which behaviour is intended.