计算机工程与应用 ›› 2018, Vol. 54 ›› Issue (5): 51-56.DOI: 10.3778/j.issn.1002-8331.1609-0338

• 理论与研发 • 上一篇    下一篇

基于页面聚类的Web应用测试方法研究

尤  枫,张雅峰,赵瑞莲,马金慧   

  1. 北京化工大学 信息科学与技术学院,北京 100029
  • 出版日期:2018-03-01 发布日期:2018-03-13

Page cluster based research on Web application test method

YOU Feng, ZHANG Yafeng, ZHAO Ruilian, MA Jinhui   

  1. College of Information Science and Technology, Beijing University of Chemical Technology, Beijing 100029, China
  • Online:2018-03-01 Published:2018-03-13

摘要: 现有的Web测试是由前端出发,通过分析页面DOM结构来获取状态与状态跳转的条件。但现有技术是将任何DOM节点的改变都认定为产生了新的DOM树,如果对于任何改变DOM结构的操作都认为是新操作来重新生成测试用例会浪费相当的时间和人力。提出一种基于页面DOM相似度的Web应用单元测试方法。利用爬虫程序获取页面状态与相应的DOM结构;利用DOM相似度对DOM进行评价,并对DOM状态进行分类,利用分类簇的中心作为相应功能的操作结果,返回应用中寻找相应的代码块并且进行测试。实验结果表明:该方法可以有效地降低“单一DOM对应单一状态”模式中的冗余状态跳转,可以达到合理的功能发现率,同时有效降低冗余的待测试状态。

关键词: 页面相似度, 页面聚类, Web应用测试

Abstract: The existing Web testing technologies mostly start from the front end, by analyzing the page DOM structure to obtain the state and the state jump condition. But all the technologies treat any DOM node changes as a new formation DOM, if any operation that leads to the change of DOM is considered as a new operation and regenerates test cases, this is a waste of time and human force. In this paper, a Web application unit test method that is based on page DOM similarity is proposed. First it uses a crawl to get the page state and the corresponding DOM structure then uses Dom similarity to evaluate and classifies the DOM, finally uses the center of the cluster as corresponding operation’s result, and returns to the application to find the code block for testing. The experimental result shows that this method can effectively reduce the redundant state jumping in “single DOM to single state” mode, and it can achieve reasonable function discovery rate, effectively reduces the redundancies of the test state.

Key words: page similarity, page cluster, Web application testing