arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2606.10417cs.SE
收藏

超越覆盖率和变异分数:实证测量测试套件行为差距

Beyond Coverage and Kill Scores: Empirically Measuring Test Suite Behavioural Gaps

University of British Columbia(不列颠哥伦比亚大学)

Partha Protim Paul, Reid Holmes

AI总结:

提出一种从自然语言文档和源码中提取预期方法级行为并映射到测试用例的方法,发现17.5%的预期行为未被测试,且行为差距与高覆盖率和变异分数不相关,表明行为覆盖是独立的测试充分性维度。

摘要:

传统的测试充分性度量衡量的是系统的实现,而不是系统是否遵循其预期行为。虽然开发者严重依赖代码覆盖率和变异测试来评估测试套件质量,但这些度量本质上是以实现为中心的,无法检测代码预期行为与实际行为之间的差距。不幸的是,目前还没有可靠的方法来检测这些差异;在本文中,我们介绍了一种自动化的概念验证方法来研究这些差距。该方法从自然语言文档和源代码中提取预期的方法级行为,将其映射到现有测试用例,并识别预期行为与已验证行为之间的差距。我们在十个流行的开源Java库(包含8,922个方法)上评估了该方法,提取了20,729个行为,精确率为93.1%。我们的实证分析保守估计,17.5%的检测到的预期行为完全未被测试,我们将其称为测试套件的行为差距。为了确定这些差距是否仅仅是人工测试的产物,我们评估了最先进的自动化测试生成器(EVOSUITE / ASTER),发现它们同样未能验证至少20.6% / 27.1%的检测到的预期行为。我们进一步证明,行为差距无法通过传统的结构度量来预测:大多数未测试的行为发生在已经具有高行覆盖的方法中,超过一半的行为差距存在于具有高变异分数的方法中。这些结果表明,行为覆盖作为测试套件充分性的一个独立维度,可以补充传统的结构度量。

英文摘要:

Traditional test adequacy metrics measure a system's implementation, not whether it adheres to its expected behaviour. While developers rely heavily on code coverage and mutation testing to assess test suite quality, these metrics are fundamentally implementation-centric and cannot detect gaps between what the code is expected to do and what it actually does. Unfortunately, there has been no way to reliably detect these discrepancies; in this paper we introduce an automated proof-of-concept approach to investigate these gaps. The approach extracts expected method-level behaviours from natural language documentation and source code, maps them to existing test cases, and identifies gaps between expected and validated behaviours. We evaluate the approach across ten popular open-source Java libraries comprising 8,922 methods, extracting 20,729 behaviours with 93.1% precision. Our empirical analysis conservatively estimates that 17.5% of detected expected behaviours remain entirely untested, which we term as the test suite's behavioural gap. To determine if these gaps are merely an artifact of human-driven testing, we evaluate state-of-the-art automated test generators (EVOSUITE / ASTER), finding that they similarly fail to validate at least 20.6% / 27.1% of detected expected behaviours. We further demonstrate that behavioural gaps are not predicted by traditional structural metrics: the majority of untested behaviours occur in methods that already have high line coverage, and over half persist in methods with high mutation kill score. These results suggest behavioural coverage acts as an independent dimension of test suite adequacy that can complement traditional structural metrics.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑