MR-Coupler: Automated Metamorphic Test Generation via Functional Coupling Analysis

📅 2026-04-11
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This work addresses the challenge that constructing effective metamorphic relations (MRs) in metamorphic testing heavily relies on domain knowledge and is thus difficult to operationalize in practice. The authors propose an automated approach that analyzes functional coupling among methods in source code to efficiently generate candidate MRs without exhaustive search. Leveraging large language models, the method synthesizes test cases and introduces a novel validation mechanism combining test amplification and mutation analysis to substantially reduce false positives. Experimental evaluation across 100 test tasks and 50 real-world bugs demonstrates that the approach achieves a valid test case generation rate exceeding 90%, representing a 64.90% improvement over baseline techniques, reduces false positives by 36.56%, and successfully detects 44% of the real defects, significantly advancing the automation and practicality of metamorphic testing.

Technology Category

Application Category

📝 Abstract
Metamorphic testing (MT) is a widely recognized technique for alleviating the oracle problem in software testing. However, its adoption is hindered by the difficulty of constructing effective metamorphic relations (MRs), which often require domain-specific or hard-to-obtain knowledge. In this work, we propose a novel approach that leverages the functional coupling between methods, which is readily available in source code, to automatically construct MRs and generate metamorphic test cases (MTCs). Our technique, MR-Coupler, identifies functionally coupled method pairs, employs large language models to generate candidate MTCs, and validates them through test amplification and mutation analysis. In particular, we leverage three functional coupling features to avoid expensive enumeration of possible method pairs, and a novel validation mechanism to reduce false alarms. Our evaluation of MR-Coupler on 100 human-written MTCs and 50 real-world bugs shows that it generates valid MTCs for over 90% of tasks, improves valid MTC generation by 64.90%, and reduces false alarms by 36.56% compared to baselines. Furthermore, the MTCs generated by MR-Coupler detect 44% of the real bugs. Our results highlight the effectiveness of leveraging functional coupling for automated MR construction and the potential of MR-Coupler to facilitate the adoption of MT in practice. We also released the tool and experimental data to support future research.
Problem

Research questions and friction points this paper is trying to address.

metamorphic testing
metamorphic relations
oracle problem
automated test generation
functional coupling
Innovation

Methods, ideas, or system contributions that make the work stand out.

metamorphic testing
functional coupling
test generation
large language models
mutation analysis
🔎 Similar Papers
No similar papers found.