计算机科学 ›› 2023, Vol. 50 ›› Issue (7): 18-26.doi: 10.11896/jsjkx.220900143

• 计算机软件 • 上一篇    下一篇

基于Web应用前端行为模型的测试用例生成

刘子文, 虞莉娟, 苏义鑫, 赵耀, 石柱   

  1. 武汉理工大学自动化学院 武汉 430070
  • 收稿日期:2022-09-16 修回日期:2023-03-24 出版日期:2023-07-15 发布日期:2023-07-05
  • 通讯作者: 虞莉娟(ylj@whut.edu.cn).
  • 作者简介:(373629126@qq.com)
  • 基金资助:
    国家自然科学基金(62176193)

Test Case Generation Based on Web Application Front-end Behavior Model

LIU Ziwen, YU Lijuan, SU Yixing, ZHAO Yao, SHI Zhu   

  1. School of Automation,Wuhan University of Technology,Wuhan 430070,China
  • Received:2022-09-16 Revised:2023-03-24 Online:2023-07-15 Published:2023-07-05
  • About author:LIU Ziwen,born in 1998,postgraduate.His main research interests include software test,computer control,computer software and machine learning.YU Lijuan,born in 1975,associate professor,graduate supervisor.Her main research interests include computer control,new energy system control and artificial intelligence.
  • Supported by:
    National Natural Science Foundation of China(62176193).

摘要: 基于Web应用前端模型的测试用例生成是Web应用测试的重要过程,但现有的大多数针对Web应用的模型都只关注Web页面及其事件,忽略了事件触发条件和后续动作。为了更准确地描述现代Web应用程序的动态行为,文中定义了一种新的Web应用前端行为模型(Front-end Behavior Model,FBM)。由于模型中迁移的触发条件可能存在内部变量,即迁移之间存在依赖关系,使得生成的测试用例不能按照输入序列执行,从而影响测试效果。为此,提出了一种优化分组遗传算法来实现可执行迁移路径FTP的自动生成,该算法考虑FTP生成问题的特点,对染色体初始化和适应度函数做出合理的设计,加入修补算子调整个体长度生成了满足迁移覆盖的FTP,并且通过引入自适应的遗传算子和模拟退火接收机制来减少迭代次数,从而加快求解速度。实验结果表明,该算法能够在更高的求解效率的基础上有效保证迁移路径的可行性以及覆盖率。

关键词: Web应用测试, 前端行为模型, 可执行测试用例生成, 分组遗传算法

Abstract: Test case generation based on Web application front-end model is an important process of Web application testing,but most existing models for Web applications only focus on Web pages and their events,ignoring event triggering conditions and subsequent actions.Therefore,in order to describe the dynamic behavior of modern Web applications more accurately,this paper defines a new Web application front-end behavior model(FBM).Because there may be internal variables in the triggering conditions of transition in the model,that is,there are dependencies between transitions,which will make the generated test cases cannot be executed according to the input sequence,thus affecting the test results.Therefore,an optimized grouping genetic algorithm is proposed to automatically generate the feasible transition path(FTP).Considering the characteristics of FTP generation problem,the algorithm makes a reasonable design of chromosome initialization and fitness function,and adds a repair operator to adjust the individual length to generate FTP which satisfies the migration coverage.This paper also introduces an adaptive genetic operator and simulated annealing receiving mechanism to reduce the number of iterations,thus improving the solution speed.Experimental results show that the algorithm can effectively guarantee the feasibility and coverage of transition path on the basis of higher solution efficiency.

Key words: Web application testing, Front-end behavior model, Feasible test case generation, Grouping genetic algorithm

中图分类号: 

  • TP311.53
[1]LEBEAU F,LEGEARD B,PEUREUX F,et al.Model-based vulnerability testing for web applications[C]//2013 IEEE Sixth International Conference on Software Testing,Verification and Validation Workshops.IEEE,2013:445-452.
[2]ANDREWS A,ALHADDAD A,BOUKHRIS S.Black-boxmodel-based regression testing of fail-safe behavior in web applications[J].Journal of Systems and Software,2019,149:318-339.
[3]GAO P,XU Y,SONG F,et al.Model-based automated testing of JavaScript Web applications via longer test sequences[J].Frontiers of Computer Science,2022,16(3):1-14.
[4]JAIN N,PORWAL R.Automated test data generation applying heuristic approaches-a survey[M]//Software Engineering.Singapore:Springer,2019:699-708.
[5]SHARMA A,PATANI R,AGGARWAL A.Software testingusing genetic algorithms[J].International Journal of Computer Science & Engineering Survey,2016,7(2):21-33.
[6]PANIGRAHI S S,JENA A K.Spider Monkey Particle Swarm Optimization(SMPSO) With Coverage Criteria for Optimal Test Case Generation in Object-Oriented Systems[J].International Journal of Open Source Software and Processes(IJOSSP),2022,13(1):1-20.
[7]SHIROLE M,KUMAR R.UML behavioral model based testcase generation:a survey[J].ACM SIGSOFT Software Engineering Notes,2013,38(4):1-13.
[8]JOSHI S,AGRAWAL N,KRISHNAPURAM R,et al.A bag of paths model for measuring structural similarity in web documents[C]//Proceedings of the ninth ACM SIGKDD International Conference on Knowledge Discovery and Data Mining.2003:577-582.
[9]MIRZAAGHAEI M,MESBAH A.DOM-based test adequacycriteria for web applications[C]//Proceedings of the 2014 International Symposium on Software Testing and Analysis.2014:71-81.
[10]PRETSCHNER A,PRENNINGER W,WAGNER S,et al.One evaluation of model-based testing and its automation[C]//Proceedings of the 27th International Conference on Software Engineering.2005:392-401.
[11]MATTIELLO G R,ENDO A T.Model-based testing leveraged for automated web tests[J].Software Quality Journal,2021:1-29.
[12]PRADHAN S,RAY M,SWAIN S K.Transition coverage based test case generation from state chart diagram[J].Journal of King Saud University-Computer and Information Sciences,2019,34(3):993-1002.
[13]FALKENAUER E.A hybrid grouping genetic algorithm for bin packing[J].Journal of Heuristics,1996,2(1):5-30.
[14]FALKENAUER E.A new representation and operators for genetic algorithms applied to grouping problems[J].Evolutionary Computation,1994,2(2):123-144.
[15]GAO X D,ZHOU L J,ZHANG S D,et al.Research on test data automatic generation based on improved genetic algorithm[J].Computer Science,2017,44(3):209-214.
[16]LIN M,LIU B X,LIN X Y.Hybrid discrete cuckoo search algorithm with metropolis criterion for traveling salesman problem[J].Journal of Nanjing University(Natural Sciences),2017,53(5):972-983.
[17]MCCABE T J.A complexity measure[J].IEEE Transactions on Software Engineering,1976(4):308-320.
[18]CRUZ-LEMUS J A,MAES A,GENERO M,et al.The impact of structural complexity on the understandability of UML statechart diagrams[J].Information Sciences,2010,180(11):2209-2220.
[19]KALAJI A S,HIERONS R M,SWIFT S.An integrated search-based approach for automatic testing from extended finite state machine(EFSM) models[J].Information and Software Techno-logy,2011,53(12):1297-1318.
[20]SWAIN R,PANTHI V,BEHERA P K,et al.Automatic test case generation from UML state chart diagram[J].International Journal of Computer Applications,2012,42(7):26-36.
[21]KALAEE A,RAFE V.Model-based test suite generation forgraph transformation system using model simulation and search-based techniques[J].Information and Software Technology,2019,108:1-29.
[22]CHOI Y M,LIM D J.Automatic feasible transition path generation from UML state chart diagrams using grouping genetic algorithms[J].Information and Software Technology,2018,94:38-58.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!