When a correct answer is difficult to establish directly, use AI to help design tests in which a controlled change to the input should produce a predictable relationship between outputs. This is the idea behind metamorphic testing. It can expose inconsistent calculations, ordering errors and broken assumptions without requiring an exact expected answer for every large input. Passing such a test is evidence about a particular property, not proof that the entire output is correct.
This international guide follows fictional resource coordinator Mira, who checks a synthetic worksheet-inventory calculator. All illustrative tool outputs are invented. SuperIntelligence is the future-facing theme of this series, not a claim that current AI has demonstrated general superintelligence. The exercise adapts a software-testing technique to teach independent verification.
- Identify a property that should remain true when the input changes.
- Define the conditions under which the property applies.
- Compare an original test and one or more transformed tests.
- Distinguish observed outputs from independently expected relationships.
- Investigate failed relationships without assuming their cause.
- Combine relationship tests with exact reference cases and human review.
EDUKATE · VOCABULARY CODING AND ENGINEERING · PART 113 · TWENTY-NINTH COLLECTION
Find your next useful step
Continue the series: Parts 113–116
- Part 113: Testing answers through predictable input changes — you are here
- Part 114: Updating probabilities as evidence arrives
- Part 115: Connecting work in progress and delivery time
- Part 116: Separating effective dates from recording dates
Parts 109–112: interacting factors, missing data, requirements and file integrity · Part 100 capstone · Begin the complete series
Full chapter index
Define properties and transformations
Calculate relationship tests
Check conditions and counterexamples
Design a reusable verification process
Teach and transfer the method
1. Define the verification problem
Mira has an inventory calculator intended to add quantities of the same kind across distinct synthetic resource records. She wants to check its behaviour even when a very long list is difficult to calculate by hand.
The purpose is to establish evidence for specified properties. It is not to delegate acceptance to the calculator being tested.
2. Distinguish an exact expected result from a relationship
For a short list of 3, 5 and 7, the independently calculated correct sum is 15. A direct comparison can verify that particular answer.
For a long list, a controlled transformation may provide a different kind of evidence. A permutation should leave a genuine sum unchanged even before the exact total is known.
Contents · Previous chapter · Next chapter
3. Name the original and follow-up inputs
Call the original list X and a transformed list X-prime. Use identifiers and preserve both inputs. The expected relationship must be stated before inspecting the follow-up result.
The transformation is part of the test specification. A vague request to try another example cannot establish whether a particular property held.
Contents · Previous chapter · Next chapter
4. Choose a permutation test
Reorder the same distinct records without altering their quantities, eligibility or identity. If the requested function is an order-independent sum, the result should be unchanged.
This property would be inappropriate for an operation that depends on the sequence, such as a cumulative balance or a first-come-first-served queue.
Related guide: regression testing.
Contents · Previous chapter · Next chapter
5. Calculate an illustrative result
The fictional original tool returns 15 for quantities 3, 5, 7. A reordered input 7, 3, 5 returns 15. The stipulated permutation check passes.
The result verifies this relationship for this pair only. It does not establish that every possible reordering is handled correctly.
Contents · Previous chapter · Next chapter
6. Choose a zero-addition test
Append one distinct eligible resource record with a valid observed quantity of zero. Under the stated summation rule, the total should remain the same.
A missing quantity is not a zero quantity. A duplicate identifier might also trigger different processing. The input must satisfy the defined conditions.
Contents · Previous chapter · Next chapter
7. Choose a scaling test
Multiply every quantity by two while keeping the unit and eligibility rules constant. For a plain sum, the transformed output should be twice the original.
If the original output is 15, the expected follow-up output is 30. This relationship does not automatically apply to capped or rounded totals.
Contents · Previous chapter · Next chapter
8. Inspect a fictional failed scaling test
Suppose the tool returns 29 for quantities 6, 10 and 14. The required relationship fails because 29 is not twice 15.
This flags an inconsistency. It does not yet establish whether the original calculation, the transformed calculation or the transformation itself contains the error.
| Test | Input quantities | Stipulated output | Expected relationship | Result |
|---|---|---|---|---|
| Original | 3, 5, 7 | 15 | Exact reference = 15 | Pass |
| Permutation | 7, 3, 5 | 15 | Same as original | Pass |
| Zero addition | 3, 5, 7, 0 | 15 | Same as original | Pass |
| Doubling | 6, 10, 14 | 29 | 2 × 15 = 30 | Fail |
Contents · Previous chapter · Next chapter
9. Choose a partition test
Divide the distinct records into disjoint sets A and B, without losing or duplicating a record. A plain sum over all records should equal the sum of the two subset totals.
With A containing 3 and 5 and B containing 7, the independently computed subset totals are 8 and 7. Their combined total is 15.
Contents · Previous chapter · Next chapter
10. Check the partition conditions
The two subsets must cover the original eligible records exactly once. If a record appears in both subsets, adding their results may count it twice.
Some operations are not additive. Two subset averages cannot generally be added to obtain the overall average.
Related guide: counterexamples.
Contents · Previous chapter · Next chapter
11. Recognise a consistently wrong tool
A defective calculator that always returns zero would pass a permutation test, a doubling test and many partition tests. It would still fail the exact reference case of 3, 5 and 7.
A relationship check can detect some classes of defects but not all. Combine several properties and independently solved reference cases.
| Method | Correct sum | Defective always-zero function |
|---|---|---|
| Permutation relationship | Pass | Pass |
| Doubling relationship | Pass | Pass |
| Partition relationship | Pass | Pass |
| Exact case: sum 3, 5, 7 = 15 | Pass | Fail |
Contents · Previous chapter · Next chapter
12. Check whether the transformation is legitimate
For a total calculated only from quantities above a threshold, multiplying quantities can move records into or out of eligibility. A simple doubling relationship may no longer hold.
Write the rule and domain before applying a test. A failed invalid relationship is not evidence that the target tool is broken.
Contents · Previous chapter · Next chapter
13. Test units deliberately
A physical length expressed as 1 metre should represent the same length as 100 centimetres when an appropriate conversion is applied. A raw numeric sum of mixed units has a different meaning.
Test unit handling separately from numerical consistency. Never assume a format conversion preserves the underlying quantity automatically.
Contents · Previous chapter · Next chapter
14. Distinguish duplicate invariance from sum invariance
Adding a genuinely new record with quantity five should increase a sum by five. Repeating an already processed identifier may have different semantics under a deduplication rule.
Do not treat duplicate records as independent observations unless that is what the task requires. Specify which identity behaviour should be tested.
Contents · Previous chapter · Next chapter
15. Handle rounding appropriately
Scaling a rounded result can differ from rounding the scaled exact result. Floating-point arithmetic can also introduce very small numerical differences.
Define suitable tolerances and comparison points in advance where needed. Do not widen a tolerance simply to make a failed check pass.
Contents · Previous chapter · Next chapter
16. Inspect generated text with semantic constraints
In a synthetic summary task, changing a passage’s order might be expected to preserve certain explicitly stated facts but not every word of a summary.
Define the facts to verify and use appropriate human review. Similar-looking prose is not an exact numerical equality test.
Related guide: checking units.
Contents · Previous chapter · Next chapter
17. Distinguish deterministic and variable outputs
A deterministic calculation should be reproducible under the same conditions. A generative assistant may produce different wording or even different candidate results across runs.
Specify the reproducibility requirement for the task. Repeated runs provide additional evidence but do not turn an unsuitable property into a valid one.
Contents · Previous chapter · Next chapter
18. Give AI a bounded testing brief
Ask for candidate input transformations, expected relationships, validity conditions, and small exact reference cases. Require the assistant to label proposed relationships as unverified until reviewed.
Run checks only on permitted synthetic or authorised test inputs. Independently verify the expected property and actual outputs.
Contents · Previous chapter · Next chapter
19. Maintain a failure investigation record
Record the original input, transformed input, expected relationship, actual outputs, execution environment, and observed discrepancy.
Investigate input preparation, transformation validity, tool versions and calculations before assigning a cause. Preserve the original failure for later retesting.
Contents · Previous chapter · Next chapter
20. Connect to regression tests
After a defect is repaired, keep the failed relationship as a repeatable regression test, along with the input conditions under which it applies.
A new version can pass the old test but fail a different property. Add meaningful checks without treating the number of tests as proof of quality.
Contents · Previous chapter · Next chapter
21. Write the verification conclusion
For the fictional calculator, permutation, zero-addition and partition results may pass, while the stipulated doubling check fails. The appropriate conclusion is unresolved reliability for the stated sum function.
Do not certify the entire calculator because several examples passed. Report the specific evidence and missing checks.
Related guide: requirements-to-evidence verification.
Contents · Previous chapter · Next chapter
22. Practise with a changed example
A list contains 2, 4 and 9. Its sum is 15. Reversing the list should preserve 15, adding an observed zero should preserve 15, and tripling every quantity should produce 45.
Now change the requested function to the maximum quantity. Explain which relationships still apply and why summing partition maxima would be wrong.
Contents · Previous chapter · Next chapter
23. Connect across zoom levels
A learner can test arithmetic relationships, a teacher can check synthetic examples, and a team can design automated checks for a defined data transformation.
Larger or consequential systems require suitable assurance and specialist review. Relationship testing is one component of that work.
Contents · Previous chapter · Next chapter
24. Connect vocabulary, Ztime and EnDist
Vocabulary Coding and Engineering distinguishes original input, transformation, expected relationship, observed output, tolerance and failure. Ztime preserves which property was tested against which version.
EnDist is a conceptual lens for reducing misunderstanding and avoidable rework, not physical energy or a validated numerical metric.
Read more: shared vocabulary · EnDist in Civilisation OS.
Contents · Previous chapter · Next chapter
25. Four weeks of practice
Week one: choose a simple function and verify exact reference examples. Week two: design three legitimate transformations and test their expected relationships.
Week three: introduce a deliberately incorrect function and identify which tests detect it. Week four: document a combined direct and relationship-based test suite and transfer it to a different task.
Contents · Previous chapter · Next chapter
26. Questions beginners ask and the next useful step
Can a passed relationship prove a complete answer is correct? No. Can a failed check reveal that the relationship itself was inappropriate? Yes. Does metamorphic testing replace exact reference tests? No.
For your next difficult low-stakes calculation, write one relationship that the correct function must preserve. Test the relationship and retain its conditions before trusting the result.
Segura, Fraser, Sánchez and Ruiz-Cortés, A Survey on Metamorphic Testing (2016), explains testing through relationships between transformed inputs and corresponding outputs when a direct expected result is difficult to determine. This guide uses original teaching examples rather than reporting the paper’s experimental results.
Contents · Previous chapter · Continue learning: next guide in this collection