metamorphic-testing
Installation
SKILL.md
Metamorphic testing
The oracle problem
Ordinary testing needs a known correct answer:
assert add(2, 2) == 4
Much real code has no such oracle. What is the correct output of a search ranking, a route planner, a compiler optimization, a recommendation model, a physics simulation, a float-heavy numerical routine? Computing the expected answer independently would mean writing the program a second time.
The usual responses both fail. Asserting the current output freezes today's bugs as the specification (a golden test that certifies whatever it does now). Asserting only that it does not crash tests almost nothing.
The technique
Do not assert what one output is. Assert how outputs relate when the input changes in a known way. That relation is a metamorphic relation.