注册
登录
新闻动态
其他科技
返回
覆盖率与测试套件有效性不强相关
作者:
糖果
发布时间:
2024-10-02 03:12:12 (4天前)
来源:
test-suite-effectiveness.html
> 关键词:测试 我最近的一个爱好项目是 一个用于进行基础数据科学的基于块的工具,当它的测试套件达到 100% 的行覆盖率时,我感到非常高兴。然而, [ Inozemtseva2014 ]发现,一旦考虑到测试套件的大小,代码覆盖率就不能很好地预测测试套件在检测错误方面的有效性。这是他们得出这个结论的方法: 作者使用了五个大型开源 Java 项目作为主题(其中“大”的意思是“大约 10 万行代码”)。这些项目中的每一个都已经有 1000 种或更多的测试方法。 他们使用一种工具生成每个程序的变异版本,该工具(例如)随机替换一些>比较,>=反之亦然。只有项目的原始测试套件可以检测到的变异程序才会被保留以供进一步分析。 接下来,他们选择了项目原始测试套件的不同大小的随机子集,针对有缺陷的突变体运行每个子集,并计算子集测试套件捕获错误的频率。 这种方法允许作者处理比他们无法检查的更大的程序和测试套件。他们的结论? “……测试套件的有效性与其包含的测试方法的数量之间存在中等至非常高的相关性。” “……当忽略套件大小的影响时,测试套件的有效性和覆盖率之间存在中等至高度的相关性。” “......当套房大小受到控制时,覆盖率和有效性之间的相关性会下降。在这种下降之后,相关性通常从低到中等,这意味着假设有效性与覆盖率相关通常是不安全的。” 换句话说,更多的测试确实会发现更多的错误,但具有大部分预测价值的是测试的数量而不是它们的代码覆盖率。这是一个令人惊讶的结果,所以如果你能原谅我,我有几张关于软件测试的演讲幻灯片我需要修改...... [ Inozemtseva2014 ] Laura Inozemtseva 和 Reid Holmes:“覆盖率与测试套件有效性没有很强的相关性”。 第 36 届软件工程国际会议论文集, 10.1145/2568225.2568271。 测试套件的覆盖率通常用作其检测故障能力的代理。然而,之前调查代码覆盖率和测试套件有效性之间相关性的研究未能就这些测试套件特征之间关系的性质和强度达成共识。此外,许多研究是使用小型或合成程序完成的,因此不清楚它们的结果是否可以推广到更大的程序,并且一些研究没有考虑测试套件大小的混杂影响。此外,大多数研究都是使用足够的套件完成的,这在实践中很少见,因此结果可能无法推广到典型的测试套件。我们通过评估测试套件大小、覆盖率、和大型 Java 程序的有效性。我们的研究是迄今为止文献中规模最大的:我们为五个系统生成了 31,000 个测试套件,其中包含多达 724,000 行源代码。我们测量了这些套件的语句覆盖率、决策覆盖率和修改条件覆盖率,并使用变异测试来评估它们的故障检测有效性。我们发现,当套件中的测试用例数量受到控制时,覆盖率和有效性之间存在低到中等的相关性。此外,我们发现更强的覆盖形式并不能提供对套件有效性的更深入的了解。我们的结果表明,覆盖率虽然有助于识别程序中未充分测试的部分,
收藏
举报
1 条回复
动动手指,沙发就是你的了!
登录
后才能参与评论