首页 | 本学科首页   官方微博 | 高级检索  
     

基于页面对象的Web应用测试用例生成方法
引用本文:王曙燕,郑佳妮,孙家泽.基于页面对象的Web应用测试用例生成方法[J].计算机应用,2020,40(1):212-217.
作者姓名:王曙燕  郑佳妮  孙家泽
作者单位:西安邮电大学 计算机学院, 西安 710121
基金项目:陕西省科技厅工业科技攻关项目(2018GY-014,2017GY-092);西安市科技计划项目(GXYD17.10);西安邮电大学研究生创新基金重点项目(CXJJLI2018016)。
摘    要:针对Web应用测试用例生成过程中导航图规模过大以及存在冗余测试路径的问题,提出了一种基于Selenium页面对象设计模式和图遍历算法的Web应用测试用例生成方法。首先,通过将原始页面对象进行分类,以导航页面对象类为节点、导航方法为迁移边构建页面对象导航图;其次,结合图的最短路径算法提出了一种页面对象图算法(POGA)来遍历导航图以生成测试路径集;最后,提取测试路径,利用Faker生成模拟数据,进一步生成可以直接执行的测试用例。实验结果表明:与爬取Web应用生成导航图的规模相比,该方法约简率约为89%;与基于状态迁移生成Web应用测试用例的方法相比,该方法减小了冗余和不可行路径的数量,并进一步提高了页面对象的复用率和测试用例的可维护性。

关 键 词:页面对象  Web应用  测试用例  测试路径  导航图  
收稿时间:2019-06-10
修稿时间:2019-07-21

Test case generation method for Web applications based on page object
WANG Shuyan,ZHENG Jiani,SUN Jiaze.Test case generation method for Web applications based on page object[J].journal of Computer Applications,2020,40(1):212-217.
Authors:WANG Shuyan  ZHENG Jiani  SUN Jiaze
Affiliation:School of Computer Science and Technology, Xi'an University of Posts and Telecommunications, Xi'an Shaanxi 710121, China
Abstract:To reduce the navigation graph size and redundant test paths in the generation process of Web application test cases, a Web application test case generation method based on Selenium page object design pattern and graph traversal algorithm was proposed. Firstly, by classifying the original page objects, the page object navigation graph with navigation page object class as the node and the navigation method as the migration edge was created. Secondly, with the shortest-path algorithm of graph, a Page Object Graph Algorithm (POGA) was proposed to realize the navigation graph traversal in order to generate test path set. Finally, the test paths were extracted and Faker was used to generate the simulated data, and the test cases that can be directly executed were produced. The experimental results show that, the proposed method has the reduction rate of about 89% compared with the navigation graph size generated by crawling Web applications, reduces the number of redundant and infeasible paths in comparison with the state migration method for generating Web application test cases, and further improves the reuse rate of page objects and the maintainability of test cases.
Keywords:page object                                                                                                                        Web application                                                                                                                        test case                                                                                                                        test path                                                                                                                        navigation graph
本文献已被 维普 万方数据 等数据库收录!
点击此处可从《计算机应用》浏览原始摘要信息
点击此处可从《计算机应用》下载全文
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号