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

使用基于频谱的故障定位调试不稳定测试

Debugging Flaky Tests using Spectrum-based Fault Localization

Martin Gruber, Gordon Fraser

AI总结:

本文提出SFFL,一种基于频谱的故障定位扩展,利用不稳定测试的覆盖变化特征,在101个Python不稳定测试上平均将故障定位到代码库的3.5%,比传统SFL提升18.7%。

摘要:

非确定性行为(即不稳定)的测试阻碍了回归测试,因为它们破坏了信任并浪费了计算和人力资源。因此,消除测试套件中的不稳定性是一个重要目标,但需要自动化调试工具来支持开发人员理解不稳定性的原因。支持常规调试的自动化方法的一个流行示例是基于频谱的故障定位(SFL),这是一种识别最可能导致故障的软件组件的技术。虽然也可以应用SFL来定位代码中可能的不稳定源,但不幸的是,不稳定性使得SFL既不精确也不确定。在本文中,我们引入了SFFL(基于频谱的不稳定故障定位),这是传统基于覆盖的SFL的扩展,利用了我们的观察结果:80%的不稳定测试在不同运行之间表现出变化的覆盖行为。通过区分稳定和不稳定的覆盖,SFFL能够更精确地定位不稳定性的来源,并保持定位本身的确定性。对来自48个开源Python项目的101个不稳定测试的评估表明,SFFL是有效的:在五种著名的SFL公式中,DStar、Ochiai和Op2产生了最佳的整体性能。平均而言,它们能够将故障位置缩小到项目代码库的3.5%,这比传统SFL(对于DStar)好18.7%。然而,SFFL的有效性取决于不稳定的根本原因:非顺序依赖的不稳定测试的来源可以比顺序依赖的故障更精确地定位。

英文摘要:

Non-deterministically behaving (i.e., flaky) tests hamper regression testing as they destroy trust and waste computational and human resources. Eradicating flakiness in test suites is therefore an important goal, but automated debugging tools are needed to support developers when trying to understand the causes of flakiness. A popular example for an automated approach to support regular debugging is spectrum-based fault localization (SFL), a technique that identifies software components that are most likely the causes of failures. While it is possible to also apply SFL for locating likely sources of flakiness in code, unfortunately the flakiness makes SFL both imprecise and non-deterministic. In this paper we introduce SFFL (Spectrum-based Flaky Fault Localization), an extension of traditional coverage-based SFL that exploits our observation that 80% of flaky tests exhibit varying coverage behavior between different runs. By distinguishing between stable and flaky coverage, SFFL is able to locate the sources of flakiness more precisely and keeps the localization itself deterministic. An evaluation on 101 flaky tests taken from 48 open-source Python projects demonstrates that SFFL is effective: Of five prominent SFL formulas, DStar, Ochiai, and Op2 yield the best overall performance. On average, they are able to narrow down the fault's location to 3.5 % of the project's code base, which is 18.7 % better than traditional SFL (for DStar). SFFL's effectiveness, however, depends on the root causes of flakiness: The source of non-order-dependent flaky tests can be located far more precisely than order-dependent faults.

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

↑