arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2404.17818cs.SE
收藏

使用不兼容 Java 版本对测试用例进行自动构建修复

Automatic Build Repair for Test Cases using Incompatible Java Versions

Ching Hang Mak, Shing-Chi Cheung

AI总结:

本文提出一种在源代码层面进行依赖最小化的方法,通过移除测试用例执行所不需要的类和方法来修复因 Java 版本不兼容导致的构建失败,并在 Defects4J 上验证了其有效性和低开销。

摘要:

背景:缺陷二分是一种常用技术,用于识别引入缺陷或间接修复缺陷的修订版本,通常需要执行项目的多个修订版本来确定该缺陷是否存在于该修订版本中。然而,由于编程语言或编译过程中使用的工具发生变化,许多遗留修订版本往往无法成功编译,这增加了二分过程的复杂性并阻碍了自动化。目标:在本文中,我们提出一种通过执行依赖最小化来修复 Java 项目测试用例的方法。我们的方法旨在移除执行一个或多个测试用例所不需要的类和方法。与现有的最先进技术不同,我们的方法在源代码层面执行最小化,从而能够修复编译时错误。方法:我们开发了一个实现该技术的独立 Java 工具,并使用针对 Java 8 和 17 重新定向的 Defects4J 中的研究对象对该技术进行了评估。结果:我们的评估表明,大多数研究对象可以仅通过执行最小化来修复,包括复现原始版本的测试结果。此外,我们的技术还被证明能够获得准确的最小化结果,同时仅给二分过程增加少量开销。结论:我们提出的技术被证明能够以最小的开销有效修复构建失败,使其适用于自动化缺陷二分。我们的工具还可以适配于缺陷语料库创建和重构等用例。

英文摘要:

Context: Bug bisection is a common technique used to identify a revision that introduces a bug or indirectly fixes a bug, and often involves executing multiple revisions of a project to determine whether the bug is present within the revision. However, many legacy revisions often cannot be successfully compiled due to changes in the programming language or tools used in the compilation process, adding complexity and preventing automation in the bisection process. Objective: In this paper, we introduce an approach to repair test cases of Java projects by performing dependency minimization. Our approach aims to remove classes and methods that are not required for the execution of one or more test cases. Unlike existing state-of-the-art techniques, our approach performs minimization at source-level, which allows compile-time errors to be fixed. Method: A standalone Java tool implementing our technique was developed, and we evaluated our technique using subjects from Defects4J retargeted against Java 8 and 17. Results: Our evaluation showed that a majority of subjects can be repaired solely by performing minimization, including replicating the test results of the original version. Furthermore, our technique is also shown to achieve accurate minimized results, while only adding a small overhead to the bisection process. Conclusion: Our proposed technique is shown to be effective for repairing build failures with minimal overhead, making it suitable for use in automated bug bisection. Our tool can also be adapted for use cases such as bug corpus creation and refactoring.

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

↑