Core Concepts
Existing developer-written test cases can embed domain knowledge that encodes metamorphic relations (MRs). MR-Scout automatically discovers and synthesizes these encoded MRs from test cases in open-source software projects to enable automated test case generation.
Abstract
The paper proposes MR-Scout, an automatic approach to discover and synthesize MRs from existing test cases.
MTC Discovery Phase:
MR-Scout derives two principal properties that characterize an MR-encoded test case (MTC): (1) containing at least two method invocations of the same class, and (2) containing at least one assertion that validates the relation between the inputs and outputs of the method invocations.
MR-Scout checks these properties in test cases from open-source projects to discover MTCs.
MR Synthesis Phase:
For discovered MTCs, MR-Scout deduces the constituents of the encoded MRs, including the source input, follow-up input, input transformation, source output, follow-up output, and output relation assertion.
MR-Scout then codifies these constituents into parameterized methods called "codified MRs" to facilitate automated test case generation.
MR Filtering Phase:
MR-Scout filters out codified MRs that demonstrate poor quality in applying to new test inputs, as codified MRs not applicable to new inputs are ineffective for new test generation.
The evaluation shows that MR-Scout can discover over 11,000 MTCs from 701 open-source projects, with over 97% precision. Over 97% of the synthesized codified MRs are of high quality for automated test case generation. The codified-MR-based tests also effectively enhance the test adequacy of programs with developer-written tests.
Stats
The length of the shortest path should be the same in either direction (a to b or b to a): |f(a,b,G)| = |f(b,a,G)|
Quotes
"Metamorphic Testing (MT) alleviates the oracle problem by defining oracles based on metamorphic relations (MRs), that govern multiple related inputs and their outputs."
"We observe that developer-written test cases can embed domain knowledge that encodes MRs. Such encoded MRs could be synthesized for testing not only their original programs but also other programs that share similar functionalities."