论文标题
在基于搜索的单元测试生成中有选择地结合多个覆盖目标
Selectively Combining Multiple Coverage Goals in Search-Based Unit Test Generation
论文作者
论文摘要
单元测试是软件开发过程的关键部分,可确保程序中基本编程单元的正确性(例如一种方法)。基于搜索的软件测试(SBST)是生成测试用例的自动化方法。 SBST通过指定覆盖标准(例如分支覆盖范围)来生成具有遗传算法的测试用例。但是,良好的测试套件必须具有不同的属性,不能使用单个覆盖标准来捕获。因此,最先进的方法结合了生成测试案例的多个标准。由于多个覆盖标准带来了多个优化目标,因此与使用单个标准相比,它损害了测试套件对某些标准的覆盖范围。为了解决这个问题,我们提出了一种名为\ textbf {smart Selection}的新方法。根据标准之间的覆盖范围相关性和覆盖目标的包含关系,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.