arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2205.15780cs.SE
收藏

预测单元测试级变形关系的复制研究

A Replication Study on Predicting Metamorphic Relations at Unit Testing Level

Alejandra Duque-Torres, Dietmar Pfahl, Rudolf Ramler, Claus Klammer

摘要:

变形测试(MT)通过检查测试执行的输入和输出之间的关系来解决测试预言问题。这种关系被称为变形关系(MR)。在目前的实践中,识别和选择合适的MR通常是一项具有挑战性的手动任务,需要彻底掌握SUT及其应用领域。因此,Kanewala等人提出了预测变形关系(PMR)方法,以从六个预定义MR的列表中自动建议MR,用于测试新开发的方法。PMR基于一个分类模型,该模型是根据从100个Java方法的控制流图(CFG)中提取的特征进行训练的。在我们的复制研究中,我们探讨了PMR的普遍性。首先,我们重建了整个预处理和训练管道,并在一个紧密的复制中重复原始研究,以验证报告的结果,并为进一步的实验奠定基础。第二,我们执行概念复制,以探索在第一步中从Java方法训练的PMR模型的可重用性,用于在Python和C++中实现功能相同的方法。最后,我们从Python和C++方法的CFG上重新训练模型,以研究对程序设计语言和实现细节的依赖性。我们能够成功地复制原始研究,实现Java方法集的可比结果。然而,基于Java的分类器的预测性能显着降低时,应用到功能等效的Python和C++方法,尽管只使用CFG功能,从语言细节抽象。由于性能再次提高时,分类器上写在Python和C++的方法的CFG进行再训练,我们得出结论,PMR的方法可以推广,但只有当分类器的开发从使用的程序设计语言中的代码文物开始。

英文摘要:

Metamorphic Testing (MT) addresses the test oracle problem by examining the relations between inputs and outputs of test executions. Such relations are known as Metamorphic Relations (MRs). In current practice, identifying and selecting suitable MRs is usually a challenging manual task, requiring a thorough grasp of the SUT and its application domain. Thus, Kanewala et al. proposed the Predicting Metamorphic Relations (PMR) approach to automatically suggest MRs from a list of six pre-defined MRs for testing newly developed methods. PMR is based on a classification model trained on features extracted from the control-flow graph (CFG) of 100 Java methods. In our replication study, we explore the generalizability of PMR. First, we rebuild the entire preprocessing and training pipeline and repeat the original study in a close replication to verify the reported results and establish the basis for further experiments. Second, we perform a conceptual replication to explore the reusability of the PMR model trained on CFGs from Java methods in the first step for functionally identical methods implemented in Python and C++. Finally, we retrain the model on the CFGs from the Python and C++ methods to investigate the dependence on programming language and implementation details. We were able to successfully replicate the original study achieving comparable results for the Java methods set. However, the prediction performance of the Java-based classifiers significantly decreases when applied to functionally equivalent Python and C++ methods despite using only CFG features to abstract from language details. Since the performance improved again when the classifiers were retrained on the CFGs of the methods written in Python and C++, we conclude that the PMR approach can be generalized, but only when classifiers are developed starting from code artefacts in the used programming language.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑