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

测试与环境复杂度会增加不稳定性吗?基于SAP HANA的实证研究

Do Test and Environmental Complexity Increase Flakiness? An Empirical Study of SAP HANA

Alexander Berndt, Thomas Bach, Sebastian Baltes

AI总结:

本研究基于SAP HANA的12周测试数据开展实证分析,发现测试执行时长与不稳定率强正相关,提出拆分长时测试可缓解测试不稳定,但需考虑拆分的设置开销。

摘要:

研究背景:测试不稳定是软件行业的一大难题。不稳定测试(flaky test)指在代码未发生变更的情况下看似随机失败的测试,会对持续集成(CI)造成阻碍。部分研究者认为,所有测试都可被视为具有不稳定性,差异仅在于不稳定失败的发生频率不同。\n研究目的:以制定缓解策略、降低测试不稳定的负面影响为目标,我们研究了可能影响测试不稳定的测试特性与测试环境特性。\n研究方法:我们基于SAP HANA为期12周的测试结果构建了两个数据集:一个基于生产数据,另一个基于专门的不稳定性实验中的定向测试执行。我们针对测试及测试环境特性对不稳定测试失败频率的影响开展了相关性分析。\n研究结果:在我们的研究中,平均测试执行时间与测试不稳定率的正相关性最强(r = 0.79),这一结果印证了此前的研究。导致不稳定性升高的潜在原因包括长时间运行测试的测试范围更大,或是测试在速度较慢的测试基础设施上执行。有意思的是,测试基础设施的负载与测试不稳定性并无相关性。测试不稳定性与测试执行所需资源之间的关系尚无定论。\n研究结论:基于我们的发现,我们得出结论:拆分长时间运行的测试是从业者应对测试不稳定的一项重要措施,因为它既支持测试执行并行化,也能降低重新执行的成本。这能有效降低复杂测试环境中测试不稳定带来的负面影响。不过,从业者在拆分长时间运行的测试时,需要考虑测试拆分可能带来的测试设置开销。

英文摘要:

Background: Test flakiness is a major problem in the software industry. Flaky tests fail seemingly at random without changes to the code and thus impede continuous integration (CI). Some researchers argue that all tests can be considered flaky and that tests only differ in their frequency of flaky failures. Aims: With the goal of developing mitigation strategies to reduce the negative impact of test flakiness, we study characteristics of tests and the test environment that potentially impact test flakiness. Method: We construct two datasets based on SAP HANA's test results over a 12-week period: one based on production data, the other based on targeted test executions from a dedicated flakiness experiment. We conduct correlation analysis for test and test environment characteristics with respect to their influence on the frequency of flaky test failures. Results: In our study, the average test execution time had the strongest positive correlation with the test flakiness rate (r = 0.79), which confirms previous studies. Potential reasons for higher flakiness include the larger test scope of long-running tests or test executions on a slower test infrastructure. Interestingly, the load on the testing infrastructure was not correlated with test flakiness. The relationship between test flakiness and required resources for test execution is inconclusive. Conclusions: Based on our findings, we conclude that splitting long-running tests can be an important measure for practitioners to cope with test flakiness, as it enables parallelization of test executions and also reduces the cost of re-executions. This effectively decreases the negative effects of test flakiness in complex testing environments. However, when splitting long-running tests, practitioners need to consider the potential test setup overhead of test splits.

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

↑