Web测试中异步等待不稳定测试的基于时间的修复
Time-based Repair for Asynchronous Wait Flaky Tests in Web Testing
AI总结:
针对Web测试中由异步等待引起的不稳定测试问题,构建数据集发现开发者常通过调整等待时间修复,据此提出基于代码相似性和历史更改的自动化修复方法TRaf,有效缩短等待时间并显著降低测试执行时间。
摘要:
异步等待是不稳定测试最普遍的根本原因之一,也是Web应用测试的主要时间影响因素。为了调查Web测试中异步等待不稳定测试的特征及其修复方法,我们构建了一个包含49个可复现不稳定测试的数据集,这些测试来自26个开源项目,均由异步等待引起,并附带了开发者编写的相应修复。我们对这些不稳定测试的研究表明,在其中约63%(49个中的31个)的测试中,开发者通过调整等待时间来解决异步等待不稳定测试,即使根本原因在其他地方也是如此。基于这一发现,我们提出了TRaf,一种针对Web应用中异步等待不稳定测试的自动化基于时间的修复方法。TRaf利用代码相似性和过去的更改历史,为Web应用中的每个异步调用建议合适的等待时间,从而解决不稳定性问题。核心洞察是,由于开发者经常不止一次地犯类似的错误,因此当前或过去的代码库中存在关于有效等待时间的提示。我们的分析表明,与开发者编写的修复相比,TRaf能建议更短的等待时间来解决测试不稳定性,将测试执行时间减少了11.1%。通过对新等待时间进行额外的动态调整,TRaf进一步将执行时间减少了20.2%。
英文摘要:
Asynchronous waits are one of the most prevalent root causes of flaky tests and a major time-influential factor of web application testing. To investigate the characteristics of asynchronous wait flaky tests and their fixes in web testing, we build a dataset of 49 reproducible flaky tests, from 26 open-source projects, caused by asynchronous waits, along with their corresponding developer-written fixes. Our study of these flaky tests reveals that in approximately 63% of them (31 out of 49), developers addressed Asynchronous Wait flaky tests by adapting the wait time, even for cases where the root causes lie elsewhere. Based on this finding, we propose TRaf, an automated time-based repair method for asynchronous wait flaky tests in web applications. TRaf tackles the flakiness issues by suggesting a proper waiting time for each asynchronous call in a web application, using code similarity and past change history. The core insight is that as developers often make similar mistakes more than once, hints for the efficient wait time exist in the current or past codebase. Our analysis shows that TRaf can suggest a shorter wait time to resolve the test flakiness compared to developer-written fixes, reducing the test execution time by 11.1%. With additional dynamic tuning of the new wait time, TRaf further reduces the execution time by 20.2%.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。