自动移除测试套件中不必要的存根
Automatically Removing Unnecessary Stubbings from Test Suites
AI总结:
本文提出ARUS技术,通过执行测试识别并基于特征自动移除测试套件中不必要的存根,在128个Java项目中实现98.6%解决率,时间成本可忽略且代码复杂性增加有限。
摘要:
大多数现代软件系统具有大量组件,其交互会影响并使测试活动复杂化。在测试期间,开发者可以通过使用测试替身和存根隔离被测代码来处理这些交互。在测试套件演进过程中,存根可能变得不必要,开发者应移除不必要的存根,因为其定义可能在测试套件的未来版本中引入不可靠的测试结果。遗憾的是,移除不必要的存根仍是一项手动任务,可能复杂且耗时。为帮助开发者完成此任务,我们提出了ARUS,一种从测试套件中自动移除不必要存根的技术。给定一个软件项目及其测试套件,该技术执行测试以识别不必要存根,然后根据存根特征使用不同方法将其移除。我们基于128个使用Mockito进行存根的Java项目进行了实证评估,这些项目包含280个存根定义,导致1,529个不必要存根。总体而言,我们的技术为276个定义提供了解决方案(98.6%的解决率),ARUS的时间成本可忽略不计,且平均而言,该技术的更改引入了有限的代码复杂性增加。我们通过拉取请求将ARUS的更改提交给项目,已有83个解决方案被合并。
英文摘要:
Most modern software systems are characterized by a high number of components whose interactions can affect and complicate testing activities. During testing, developers can account for the interactions by isolating the code under test using test doubles and stubbings. During the evolution of a test suite, stubbings might become unnecessary, and developers should remove unnecessary stubbings, as their definitions can introduce unreliable test results in future versions of the test suite. Unfortunately, removing unnecessary stubbings is still a manual task that can be complex and time-consuming. To help developers in this task, we propose ARUS, a technique to automatically remove unnecessary stubbings from test suites. Given a software project and its test suite, the technique executes the tests to identify unnecessary stubbings and then removes them using different approaches based on the characteristics of the stubbings. We performed an empirical evaluation based on 128 Java projects that use Mockito for stubbing and contain 280 stubbing definitions that lead to 1,529 unnecessary stubbings. Overall, our technique provides a solution for 276 of the definitions (98.6% resolution rate), ARUS' time cost is negligible, and, on average, the technique's changes introduce a limited increase in code complexity. We submitted ARUS' changes to the projects through pull requests and 83 resolutions are already merged.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。