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

基于搜索的单元测试生成中多覆盖目标的选择性组合

Selectively Combining Multiple Coverage Goals in Search-Based Unit Test Generation

Zhichao Zhou, Yuming Zhou, Chunrong Fang, Zhenyu Chen, Yutian Tang

摘要:

单元测试是软件开发过程的关键部分,确保程序中基本编程单元的正确性(例如,方法)。基于搜索的软件测试(SBST)是一种自动生成测试用例的方法。SBST通过指定覆盖标准(例如,分支覆盖)。然而,一个好的测试套件必须有不同的属性,这不能通过使用单独的覆盖标准来捕获。因此,最先进的方法结合了多个标准来生成测试用例。由于组合多个覆盖标准会带来多个优化目标,与使用单个标准相比,它会损害测试套件对某些标准的覆盖。为了解决这个问题,我们提出了一种新的方法命名为\textbf{smart selection}。智能选择算法根据各准则之间的覆盖相关性和覆盖目标之间的包容关系,选择覆盖目标的子集,以减少优化目标的数量,避免遗漏所有准则的任何属性。我们进行实验,以评估智能选择$400$ Java类与三个国家的最先进的遗传算法。平均而言,智能选择优于在$65.1\%$上组合两种方法之间具有显著差异的类的所有目标。

英文摘要:

Unit testing is a critical part of software development process, ensuring the correctness of basic programming units in a program (e.g., a method). Search-based software testing (SBST) is an automated approach to generating test cases. SBST generates test cases with genetic algorithms by specifying the coverage criterion (e.g., branch coverage). However, a good test suite must have different properties, which cannot be captured by using an individual coverage criterion. Therefore, the state-of-the-art approach combines multiple criteria to generate test cases. As combining multiple coverage criteria brings multiple objectives for optimization, it hurts the test suites' coverage for certain criteria compared with using the single criterion. To cope with this problem, we propose a novel approach named \textbf{smart selection}. Based on the coverage correlations among criteria and the coverage goals' subsumption relationships, smart selection selects a subset of coverage goals to reduce the number of optimization objectives and avoid missing any properties of all criteria. We conduct experiments to evaluate smart selection on $400$ Java classes with three state-of-the-art genetic algorithms. On average, smart selection outperforms combining all goals on $65.1\%$ of the classes having significant differences between the two approaches.

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

↑