基于Web的应用程序版本更新频繁,生成新的测试脚本集代价昂贵,因此修复旧的测试脚本集是最佳的选择.针对由于Web应用页面结构的改变而导致旧的测试脚本集执行时发生错误的问题,提出了一种修复失效的测试脚本的方法.该方法利用Selenium IDE录制旧版本应用程序的测试脚本,在新版本的应用上回放旧的测试脚本,生成错误的测试报告;根据报告中每条失效脚本的XPath和value信息,通过遍历新旧应用网页差异文档对象化模型解析树(DOM tree),找到替换失效脚本的路径或value值,从而修复失效的测试脚本.实验结果表明,该方法对修复失效测试脚本是可行和有效的.%The iteration of Web application version was frequent,generating a new set of test scripts was expensive,so,for testing new version of the Web application,repairing the existing test scripts set was the best option.Due to changes in the structure of Web application page caused execution error of the old set of test scripts,this paper presented a method to automatically repair the disabled test scripts.The method made use of Selenium IDE to record test scripts in older version of the application,and played back the recorded test scripts in the new version of the application,generated an error test report.According to XPath and value of each disabled test scripts in the test report,by traversing the old and new application pages on the parse tree document object model (DOM tree),found the path and assertions value of the script to replace and repair disabled test scripts.Finally,experimental results show that the method is feasible and effective in repairing disabled test scripts.
展开▼