arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.02965cs.SE
收藏

理解bug重现测试:一项初步的实证研究

Understanding Bug-Reproducing Tests: A First Empirical Study

UFMG(米纳斯吉拉斯联邦大学);University of Passau(帕绍大学)

Andre Hora, Gordon Fraser

AI总结:

本文通过分析642个真实世界Python系统中的bug重现测试,发现其在代码量、断言数量和复杂度上与常规测试无显著差异,但包含更多try/except块和弱断言,并发现95%的测试仅重现单个bug。

摘要:

开发者创建bug重现测试以支持调试,这些测试在bug存在时持续失败,一旦bug被修复则通过。这些测试通常整合到现有测试套件中,并与所有其他测试一起定期执行,以确保未来回归问题被发现。尽管与其它类型测试共存,bug重现测试的性质却很少被研究,不清楚它们是否从根本上不同。在本短篇论文中,我们提供了一项初步的实证研究以更好地理解bug重现测试。我们分析了15个真实世界的Python系统的642个bug重现测试。总体而言,我们发现bug重现测试在LOC、断言数量和复杂度方面与其它测试没有显著差异。然而,bug重现测试包含略微更多的try/except块和"弱断言"(例如assertNotEqual)。最后,我们发现大多数(95%)的bug重现测试重现单个bug,而5%重现多个bug。我们最后讨论了影响和未来研究方向。

英文摘要:

Developers create bug-reproducing tests that support debugging by failing as long as the bug is present, and passing once the bug has been fixed. These tests are usually integrated into existing test suites and executed regularly alongside all other tests to ensure that future regressions are caught. Despite this co-existence with other types of tests, the properties of bug-reproducing tests are scarcely researched, and it remains unclear whether they differ fundamentally. In this short paper, we provide an initial empirical study to understand bug-reproducing tests better. We analyze 642 bug-reproducing tests of 15 real-world Python systems. Overall, we find that bug-reproducing tests are not (statistically significantly) different from other tests regarding LOC, number of assertions, and complexity. However, bug-reproducing tests contain slightly more try/except blocks and ``weak assertions'' (e.g.,~\texttt{assertNotEqual}). Lastly, we detect that the majority (95%) of the bug-reproducing tests reproduce a single bug, while 5% reproduce multiple bugs. We conclude by discussing implications and future research directions.

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

↑