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.
翻译:单位测试是软件开发过程的一个关键部分,它确保一个程序(例如一种方法)基本编程单位的正确性。基于搜索的软件测试(SBST)是一种生成测试案例的自动化方法。SBST通过具体规定覆盖标准(例如分支覆盖)生成基因算法的测试案例。然而,好的测试套件必须具有不同的属性,不能通过使用单个覆盖标准来捕获。因此,最先进的方法结合多种标准来生成测试案例。由于多重覆盖标准为优化带来多重目标,因此与单一标准相比,它会损害测试套件对某些标准的覆盖。为了应对这一问题,我们提出了一个名为\ textbf{智能选择}的新型方法。基于标准和覆盖目标子组合关系之间的覆盖相关性,智能选择了一组覆盖目标,以减少优化目标的数量,避免遗漏所有标准的任何属性。我们进行实验,以评价40万美元Java类的智能选择,与三种最先进的遗传算法相比,它会伤害了某些标准的覆盖范围。为了应对这一问题,我们建议采用名为\ textb{Smart{price chess checks legleglections in sal, 在两个等级上存在巨大的差异。