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.
翻译:以搜索为基础的技术已被广泛用于白箱测试生成。 许多这些方法都依靠方法水平和分支距离超常性来引导搜索进程,并生成高线和分支覆盖的测试案例。 尽管这两种超常性取得了积极的成果,但它们只使用与清晰分支覆盖面有关的信息(例如,以有条件和环形语语语表示),而忽略了基本代码中潜在的隐含分支。如果这种隐含分支发生在运行时(例如,如果在无分支医学中出现例外),现有的健身功能无法指导搜索进程。为了解决这一问题,我们引入了一个新的次级目标,称为基本块覆盖,其中考虑到控制流图中相关基本块的覆盖范围。我们评估了英国广播公司对基于搜索的单元生成(使用DynMOSA算法)和基于搜索的崩溃复制(使用STD和WightedSum健康功能)的影响。我们的结果表明,对于单位测试的生成,英国广播公司改进了所生成的分支范围。尽管在小(大约1.5 % ) 英国广播公司的深度覆盖中, 也大大降低了了英国广播公司的频率, 和不断运行的频率覆盖。