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

基于强化学习的可扩展相似性感知测试套件最小化

Scalable Similarity-Aware Test Suite Minimization with Reinforcement Learning

Sijia Gu, Ali Mesbah

AI总结:

针对多准则测试套件最小化问题,提出TripRL方法,将覆盖率、故障检测能力与相似性整合进ILP并结合强化学习,实现线性可扩展,在Defects4j大型套件上47分钟内求解且保持有效性。

摘要:

多准则测试套件最小化(MCTSM)问题旨在根据代码覆盖率或故障检测能力等充分性准则移除冗余测试用例。然而,现有技术要么在故障检测能力上表现出较高的损失,要么因该问题的NP难特性而面临可扩展性挑战,这限制了其实际应用。我们提出TripRL,一种新技术,它将语句覆盖率和故障检测能力等传统准则与测试覆盖率相似性整合到整数线性规划(ILP)中,以生成具有高测试有效性的多样化精简测试套件。TripRL利用二分图表示及其嵌入来简洁地构建ILP,并将ILP与有效的强化学习(RL)训练相结合。这种结合使大规模测试套件最小化更具可扩展性,并提高了测试有效性。我们的实证评估表明,TripRL的运行时间随MCTSM问题的规模呈线性增长。值得注意的是,对于Defects4j数据集中的大型测试套件,现有方法无法在合理时间内提供解决方案,而我们的技术始终能在47分钟内提供解决方案。TripRL生成的精简测试套件在保持原始语句覆盖率和故障检测能力的同时,具有更高的检测未知故障的潜力。

英文摘要:

The Multi-Criteria Test Suite Minimization (MCTSM) problem aims to remove redundant test cases, guided by adequacy criteria such as code coverage or fault detection capability. However, current techniques either exhibit a high loss of fault detection ability or face scalability challenges due to the NP-hard nature of the problem, which limits their practical utility. We propose TripRL, a novel technique that integrates traditional criteria such as statement coverage and fault detection ability with test coverage similarity into an Integer Linear Program (ILP), to produce a diverse reduced test suite with high test effectiveness. TripRL leverages bipartite graph representation and its embedding for concise ILP formulation and combines ILP with effective reinforcement learning (RL) training. This combination renders large-scale test suite minimization more scalable and enhances test effectiveness. Our empirical evaluations demonstrate that TripRL's runtime scales linearly with the magnitude of the MCTSM problem. Notably, for large test suites from the Defects4j dataset where existing approaches fail to provide solutions within a reasonable time frame, our technique consistently delivers solutions in less than 47 minutes. The reduced test suites produced by TripRL also maintain the original statement coverage and fault detection ability while having a higher potential to detect unknown faults.

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

↑