metamorphic-test-design
Metamorphic Testing
Use this skill when a normal assertion is weak because the exact expected output is unavailable, too expensive to compute, or too brittle to maintain. The goal is to test relations between executions: if the input is transformed in a controlled way, the output must transform, remain stable, or preserve a property. Treat invariants as contracts about what must survive the transform.
Inputs
Collect the behavior under test, its input domain, known preconditions, available seed examples, and the risk you need evidence for. If an exact oracle exists for a narrow part of the domain, keep it as a calibration check, but do not make the plan depend on exact outputs everywhere.
Relation Selection
Choose relations that encode a real contract, not a convenient coincidence. Prefer relations that are explainable to a domain owner and cheap enough to run many times.
Common relation families: