Metamorphic testing alleviates the test oracle problem by defining oracles based on relations (i.e., metamorphic relations) that govern multiple related inputs and their expected outputs. However, designing MRs requires domain-specific knowledge, which may not be generally available. This hinders the widespread adoption of MT. Fortunately, we observe that developers often embed such domain knowledge that encodes MRs in test cases, even without the awareness of metamorphic testing. These encoded MRs might be generalized and useful for testing the original programs (where these MRs are found) and other programs with similar functionalities. In this paper, we propose MR-Extractor, to automatically discover metamorphic relations from existing test cases in open-source software (OSS) projects. MR-Extractor firstly identifies MR-encoded test cases in OSS, and then generalizes encoded MRs and codifies them into parameterized methods (called codified MR) for MT. Finally, MR-Extractor validates the reusability of codified MRs for new test generation. Experimental results show that (i) over 12,000 MR-encoded test cases are identified by MR-Extractor, accounting for 1.26% of the total test cases, and (ii) test cases constructed from the MRs discovered by MR-Extractor can effectively improve test coverage. Compared with developer-written test suites, codified-MR-based test suites leads to a 25.97% and 25.83% increase in the line coverage and mutation score. When compared with Evosuite-generated test suites, codified-MR-based test suites even achieves an 83.11% increase in mutant score.


翻译:蜕变测试通过定义基于关系的预言(即蜕变关系)来缓解测试预言问题,这类关系规定了多个关联输入及其预期输出。然而,设计蜕变关系需要特定领域的知识,而这些知识通常并非普遍可得。这阻碍了蜕变测试的广泛采用。幸运的是,我们发现开发者即使未意识到蜕变测试,也常常将编码了蜕变关系的领域知识嵌入测试用例中。这些被编码的蜕变关系可能具有通用性,不仅有助于测试原始程序(即发现这些蜕变关系的程序),也能用于测试具有类似功能的其他程序。本文提出MR-Extractor,用于从开源软件项目的现有测试用例中自动发现蜕变关系。MR-Extractor首先识别开源软件中编码了蜕变关系的测试用例,然后泛化这些编码的蜕变关系,并将其形式化为参数化方法(称为编码蜕变关系)以供蜕变测试使用。最后,MR-Extractor验证编码蜕变关系在生成新测试用例时的可重用性。实验结果表明:(i)MR-Extractor识别出超过12,000个编码了蜕变关系的测试用例,占测试用例总数的1.26%;(ii)基于MR-Extractor发现的蜕变关系构建的测试用例能有效提升测试覆盖率。与开发者编写的测试套件相比,基于编码蜕变关系的测试套件在行覆盖率和变异得分上分别提升了25.97%和25.83%;与Evosuite生成的测试套件相比,基于编码蜕变关系的测试套件在变异得分上甚至实现了83.11%的提升。

0
下载
关闭预览

相关内容

磁流变(Magnetorheological,简称MR)材料是一种流变性能可由磁场控制的新型智能材料。由于其响应快(ms量级)、可逆性好(撤去磁场后,又恢复初始状态)、以及通过调节磁场大小来控制材料的力学性能连续变化,因而近年来在汽车、建筑、振动控制等领域得到广泛应用。
【AAAI2021】知识图谱增强的预训练模型的生成式常识推理
100+篇《自监督学习(Self-Supervised Learning)》论文最新合集
专知会员服务
167+阅读 · 2020年3月18日
论文浅尝 | Language Models (Mostly) Know What They Know
开放知识图谱
2+阅读 · 2022年11月18日
VCIP 2022 Call for Demos
CCF多媒体专委会
1+阅读 · 2022年6月6日
RoBERTa中文预训练模型:RoBERTa for Chinese
PaperWeekly
57+阅读 · 2019年9月16日
Transferring Knowledge across Learning Processes
CreateAMind
29+阅读 · 2019年5月18日
无监督元学习表示学习
CreateAMind
27+阅读 · 2019年1月4日
Unsupervised Learning via Meta-Learning
CreateAMind
44+阅读 · 2019年1月3日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
18+阅读 · 2018年12月24日
【论文】变分推断(Variational inference)的总结
机器学习研究会
39+阅读 · 2017年11月16日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2008年12月31日
Arxiv
0+阅读 · 2023年6月1日
Arxiv
12+阅读 · 2023年1月19日
Arxiv
15+阅读 · 2021年11月19日
VIP会员
最新内容
网状网络及其在军事领域的运用
专知会员服务
1+阅读 · 今天6:18
无美国参与的欧洲战争方式(万字长文)
专知会员服务
2+阅读 · 今天5:54
《国防领域敏感性分析白皮书》
专知会员服务
2+阅读 · 今天3:42
综述 | 从问答到任务完成:Agent系统与Harness设计
Agentic RL:框架、实践与长程智能体训练
专知会员服务
3+阅读 · 6月24日
重新思考无人机时代的生存能力
专知会员服务
7+阅读 · 6月24日
装甲突击旅:现代战争思考、战斗与组织
专知会员服务
5+阅读 · 6月24日
在人工智能加速决策环境中拓展OODA循环
专知会员服务
7+阅读 · 6月24日
军事欺骗:供作战战术指挥官使用的工具
专知会员服务
5+阅读 · 6月24日
相关VIP内容
【AAAI2021】知识图谱增强的预训练模型的生成式常识推理
100+篇《自监督学习(Self-Supervised Learning)》论文最新合集
专知会员服务
167+阅读 · 2020年3月18日
相关基金
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2008年12月31日
Top
微信扫码咨询专知VIP会员