一句话:提出 Semter,利用测试执行中捕获的语义信息计算元素相似度,自动修复因元素定位失效或页面增删而损坏的 Web 测试脚本。
Web 应用在演化过程中,自动化功能测试脚本常常失效,其中 Web 元素定位器是导致测试中断的首要原因。人工修复费时费力,现有自动修复技术主要依赖 DOM 属性或元素的视觉外观来重新定位元素,忽略了元素本身的语义信息。本文提出一种新颖的语义化测试修复技术 Semter:首先在应用基础版本的测试执行过程中捕获相关语义信息,然后通过计算元素之间的语义相似度来定位目标元素,从而修复失效的测试脚本;针对因页面新增或删除导致的测试工作流中断,Semter 还通过在更新版本上进行局部探索来修复测试工作流。作者在六个真实 Web 应用上与三个基线方法进行了对比评估,实验结果表明 Semter 在可接受的时间开销内平均修复率达到 84%,显著优于当前最先进的 Web 测试修复技术。
Automation testing is widely used in the functional testing of web applications. However, during the evolution of web applications, such web test scripts tend to break. It is essential to repair such broken test scripts to make regression testing run successfully. As manual repairing is time-consuming and expensive, researchers focus on automatic repairing techniques. Empirical study shows that the web element locator is the leading cause of web test breakages. Most existing repair techniques utilize Document Object Model attributes or visual appearances of elements to find their location but neglect their semantic information. This paper proposes a novel semantic repair technique called Semantic Test Repair (Semter) for web test repair. Our approach captures relevant semantic information from test executions on the application’s basic version and locates target elements by calculating semantic similarity between elements to repair tests. Our approach can also repair test workflow due to web page additions or deletions by a local exploration in the updated version. We evaluated the efficacy of our technique on six real-world web applications compared with three baselines. Experimental results show that Semter achieves an 84% average repair ratio within an acceptable time cost, significantly outperforming the state-of-the-art web test repair techniques.