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

是什么让这个测试片?查明导致测试不稳定的类

What Made This Test Flake? Pinpointing Classes Responsible for Test Flakiness

Sarra Habchi, Guillaume Haben, Jeongju Sohn, Adriano Franci, Mike Papadakis, Maxime Cordy, Yves Le Traon

摘要:

Flaky测试被定义为通过对同一版本的代码间歇性地通过和失败来表现非确定性行为的测试。这些测试通过错误的警报削弱了持续集成,浪费了开发人员的时间,破坏了他们对回归测试的信任。为了减轻片状的影响,研究人员和工业专家都提出了检测和隔离片状测试的策略和工具。然而,由于开发人员难以本地化和理解其原因,因此很少修复故障测试。此外,使用大型代码库的开发人员通常需要知道非确定性的来源以保持代码质量,即,避免引入与不确定性行为有关的技术债务,并避免引入新的风险测试。为了帮助完成这些任务,我们提出了将故障定位技术重新定位到故障组件定位问题,即,精确定位导致测试不确定性行为的程序类。特别是,我们采用基于频谱的故障定位(SBFL),一种基于覆盖的故障定位技术,通常采用其简单性和有效性。我们还利用其他数据源,如更改历史和静态代码指标,以进一步改善本地化。我们的研究结果表明,增加SBFL的变化和代码指标排名前1和前5名的建议,在26%和47%的情况下,类。总的来说,我们成功地减少了平均数量的类检查,以找到第一个类的19%的类覆盖的类测试。我们的研究结果还表明,本地化的方法是有效的主要片状类别,如并发和异步等待,表明他们的一般能力,以确定分布式组件。

英文摘要:

Flaky tests are defined as tests that manifest non-deterministic behaviour by passing and failing intermittently for the same version of the code. These tests cripple continuous integration with false alerts that waste developers' time and break their trust in regression testing. To mitigate the effects of flakiness, both researchers and industrial experts proposed strategies and tools to detect and isolate flaky tests. However, flaky tests are rarely fixed as developers struggle to localise and understand their causes. Additionally, developers working with large codebases often need to know the sources of non-determinism to preserve code quality, i.e., avoid introducing technical debt linked with non-deterministic behaviour, and to avoid introducing new flaky tests. To aid with these tasks, we propose re-targeting Fault Localisation techniques to the flaky component localisation problem, i.e., pinpointing program classes that cause the non-deterministic behaviour of flaky tests. In particular, we employ Spectrum-Based Fault Localisation (SBFL), a coverage-based fault localisation technique commonly adopted for its simplicity and effectiveness. We also utilise other data sources, such as change history and static code metrics, to further improve the localisation. Our results show that augmenting SBFL with change and code metrics ranks flaky classes in the top-1 and top-5 suggestions, in 26% and 47% of the cases. Overall, we successfully reduced the average number of classes inspected to locate the first flaky class to 19% of the total number of classes covered by flaky tests. Our results also show that localisation methods are effective in major flakiness categories, such as concurrency and asynchronous waits, indicating their general ability to identify flaky components.

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

↑