论文标题
基于搜索的单元测试和崩溃复制的基本块覆盖范围
Basic Block Coverage for Search-based Unit Testing and Crash Reproduction
论文作者
论文摘要
基于搜索的技术已被广泛用于白盒测试生成。这些方法中的许多方法都依赖于进近级别和分支距离启发式方法来指导搜索过程并生成具有高线和分支覆盖率的测试用例。尽管这两种启发式方法取得了积极的结果,但它们仅使用与显式分支的覆盖范围有关的信息(例如,用条件和循环语句表示),但忽略了代码基本块中潜在的隐式分支。如果这种隐式分支在运行时发生(例如,如果在无分支机构中抛出异常),则现有的健身功能将无法指导搜索过程。为了解决此问题,我们引入了一个新的次要目标,称为基本块覆盖范围(BBC),该目标考虑了控制流程图中相关基本块的覆盖范围。我们评估了BBC对基于搜索的单元测试生成(使用Dynamosa算法)和基于搜索的崩溃复制的影响(使用Stdistance和加权功能功能)。我们的结果表明,对于单位测试,BBC改善了生成的测试的分支覆盖范围。尽管很小(约1.5%),但分支覆盖范围的这种改善是系统的,导致输出域覆盖率和隐式运行时异常覆盖范围以及运行时状态的多样性的增加。就崩溃复制而言,结合了stdistance和加权,BBC有助于复制每个健身功能的3个新崩溃。英国广播公司(BBC)大大减少了使用stdistance和加权造成的崩溃的43.5%和45.1%所需的时间。对于这些崩溃,BBC将消费时间缩短了71.7%(对于Stdistance),平均将消耗的时间减少了68.7%(对于加权服务)。
Search-based techniques have been widely used for white-box test generation. Many of these approaches rely on the approach level and branch distance heuristics to guide the search process and generate test cases with high line and branch coverage. Despite the positive results achieved by these two heuristics, they only use the information related to the coverage of explicit branches (e.g., indicated by conditional and loop statements), but ignore potential implicit branchings within basic blocks of code. If such implicit branching happens at runtime (e.g., if an exception is thrown in a branchless-method), the existing fitness functions cannot guide the search process. To address this issue, we introduce a new secondary objective, called Basic Block Coverage (BBC), which takes into account the coverage level of relevant basic blocks in the control flow graph. We evaluated the impact of BBC on search-based unit test generation (using the DynaMOSA algorithm) and search-based crash reproduction (using the STDistance and WeightedSum fitness functions). Our results show that for unit test generation, BBC improves the branch coverage of the generated tests. Although small (around 1.5%), this improvement in the branch coverage is systematic and leads to an increase of the output domain coverage and implicit runtime exception coverage, and of the diversity of runtime states. In terms of crash reproduction, in the combination of STDistance and WeightedSum, BBC helps in reproducing 3 new crashes for each fitness function. BBC significantly decreases the time required to reproduce 43.5% and 45.1% of the crashes using STDistance and WeightedSum, respectively. For these crashes, BBC reduces the consumed time by 71.7% (for STDistance) and 68.7% (for WeightedSum) on average.