Often you cannot say what the right answer is for every input. A metamorphic test sidesteps that. Instead of checking one answer, it checks a relation between two answers: if I change the input in a way that should not matter, the decision must not change.
Two relations work for almost any AI feature:
- Paraphrase: the same request in different words gets the same decision.
- Irrelevant text: adding a sentence that has nothing to do with the request changes nothing.
RefundBot can answer in JSON mode, where its reply carries a field eligible: true or false. Compare that field, not the wording. Wording changes on every call, even on a correct build.
Your task
Write both relations as tests. Some faulty builds only go wrong for some numbers of days, so test several values on both sides of the 30-day window, such as 29, 31 and 60.