留言板

尊敬的读者、作者、审稿人, 关于本刊的投稿、审稿、编辑和出版的任何问题, 您可以本页添加留言。我们将尽快给您答复。谢谢您的支持!

姓名
邮箱
手机号码
标题
留言内容
验证码

利用改进遗传算法的软件故障定位辅助测试用例生成方法

杨波 何宇泽 许福 陈志泊

杨波,何宇泽,许福,等. 利用改进遗传算法的软件故障定位辅助测试用例生成方法[J]. 北京航空航天大学学报,2023,49(9):2279-2288 doi: 10.13700/j.bh.1001-5965.2022.0524
引用本文: 杨波,何宇泽,许福,等. 利用改进遗传算法的软件故障定位辅助测试用例生成方法[J]. 北京航空航天大学学报,2023,49(9):2279-2288 doi: 10.13700/j.bh.1001-5965.2022.0524
YANG B,HE Y Z,XU F,et al. Using improved genetic algorithm for software fault localization aided test case generation[J]. Journal of Beijing University of Aeronautics and Astronautics,2023,49(9):2279-2288 (in Chinese) doi: 10.13700/j.bh.1001-5965.2022.0524
Citation: YANG B,HE Y Z,XU F,et al. Using improved genetic algorithm for software fault localization aided test case generation[J]. Journal of Beijing University of Aeronautics and Astronautics,2023,49(9):2279-2288 (in Chinese) doi: 10.13700/j.bh.1001-5965.2022.0524

利用改进遗传算法的软件故障定位辅助测试用例生成方法

doi: 10.13700/j.bh.1001-5965.2022.0524
基金项目: 中央高校基本科研业务费专项资金(BLX202003);国家自然科学基金(61502011);北京林业大学热点追踪项目(BLRD202124)
详细信息
    通讯作者:

    E-mail:xufu@bjfu.edu.cn

  • 中图分类号: V221+.3;TB553

Using improved genetic algorithm for software fault localization aided test case generation

Funds: Fundamental Research Funds for the Central Universities (BLX202003); National Natural Science Foundation of China (61502011);Focus Tracking Project of Beijing Forestry University (BLRD202124)
More Information
  • 摘要:

    在软件故障自动化定位过程中,如果在给定的测试用例集合情况下故障在故障疑似度列表种排名不高,比较有效的方法为补充新的测试用例。如何在较小的代价下提升故障的可疑度排名是一项具有挑战的工作。提出一种基于改进遗传算法(IGA)的测试用例生成方法,利用软件故障定位的疑似故障排名,来辅助生成软件故障定位过程中的测试用例。依次对所提方法进行阐述和分析,在6个C程序和2个Python程序上开展实验,实验结果表明:所提方法自动生成的测试用例能够有效地帮助提高故障定位的效率。

     

  • 图 1  本文方法框架

    Figure 1.  Framework of proposed method

    图 2  最高语句覆盖率

    Figure 2.  Highest statement coverage

    图 3  平均语句覆盖率

    Figure 3.  Average statement coverage

    图 4  平均条件覆盖数

    Figure 4.  Average condition coverage

    图 5  故障语句覆盖率

    Figure 5.  Faulty statement coverage

    表  1  实验程序信息

    Table  1.   Experimental objects informations

    程序语句数测试用例数目
    Print_token1(Pt1)5634130
    Print_token2(Pt2)5084115
    Tcas1731607
    Schedule1(Sch1)4102650
    Schedule2(Sch2)3072710
    Tot_info(Tot)4061052
    Difflib1937100
    Zipfile2440100
    下载: 导出CSV

    表  2  测试用例应用到故障定位的效率比较(Print_token1程序)

    Table  2.   Comparison of the efficiency of test case applied to fault location(Print_token1)

    故障定位方法原始检查
    语句数
    目前检查
    语句数
    检查语句
    的减少率 /%
    XGBoost62690.32
    D3Star3609773.05
    GP1929717341.75
    Ochiai12979767.34
    下载: 导出CSV

    表  3  测试用例应用到故障定位的效率比较(Print_token2程序)

    Table  3.   Comparison of the efficiency of test case applied to fault location(Print_token2)

    故障定位方法原始检查
    语句数
    目前检查
    语句数
    检查语句
    的减少率/%
    XGBoost1601690.00
    D3Star615214.80
    GP191825271.43
    Ochiai164614.69
    下载: 导出CSV

    表  4  测试用例应用到故障定位的效率比较(Tot_info程序)

    Table  4.   Comparison of the efficiency of test case applied to fault location(Tot_info)

    故障定位方法原始检查
    语句数
    目前检查
    语句数
    检查语句
    的减少率/%
    XGBoost492451.02
    D3Star3578077.59
    GP1936928021.57
    Ochiai13578077.59
    下载: 导出CSV

    表  5  测试用例应用到故障定位的效率比较(Schedule1程序)

    Table  5.   Comparison of the efficiency of test case applied to fault location(Schedule1)

    故障定位方法原始检查
    语句数
    目前检查
    语句数
    检查语句
    的减少率/%
    XGBoost8650.00
    D3Star2026−30.00
    GP19128139−8.59
    Ochiai12026−30.00
    下载: 导出CSV

    表  6  测试用例应用到故障定位的效率比较(Schedule2程序)

    Table  6.   Comparison of the efficiency of test case applied to fault location(Schedule2)

    故障定位方法原始检查
    语句数
    目前检查
    语句数
    检查语句
    的减少率/%
    XGBoost1324168.94
    D3Star921682.61
    GP19921682.61
    Ochiai1921682.61
    下载: 导出CSV

    表  7  测试用例应用到故障定位的效率比较(Tcas程序)

    Table  7.   Comparison of the efficiency of test case applied to fault location(Tcas)

    故障定位方法原始检查
    语句数
    目前检查
    语句数
    检查语句
    的减少率/%
    XGBoost59591.52
    D3Star723255.00
    GP19846028.57
    Ochiai1723255.00
    下载: 导出CSV

    表  8  测试用例应用到故障定位的效率比较(Difflib程序)

    Table  8.   Comparison of the efficiency of test case applied to fault location(Difflib)

    故障定位方法原始检查
    语句数
    目前检查
    语句数
    检查语句
    的减少率/%
    XGBoost51510
    D3Star1364765.44
    GP191364765.44
    Ochiai11364765.44
    下载: 导出CSV

    表  9  测试用例应用到故障定位的效率比较(Zipfile程序)

    Table  9.   Comparison of the efficiency of test case applied to fault location(Zipfile)

    故障定位方法原始检查
    语句数
    目前检查
    语句数
    检查语句
    的减少率/%
    XGBoost1219323.14
    D3Star33614656.55
    GP1933614656.55
    Ochiai133614656.55
    下载: 导出CSV
  • [1] TRACEY N J. A search-based automated test-data generation framework for safety-critical software[D]. York: The University of York, 2001.
    [2] HARMAN M, JONES B F. Search-based software engineering[J]. Information and Software Technology, 2001, 43(14): 833-839. doi: 10.1016/S0950-5849(01)00189-6
    [3] RUAN H, ZHANG J, YAN J. Test data generation for C programs with string-handling functions[C]// 2008 2nd IFIP/IEEE International Symposium on Theoretical Aspects of Software Engineering. Piscataway: IEEE Press, 2008: 219-226.
    [4] DEMILLI R A, OFFUTT A J. Constraint-based automatic test data generation[J]. IEEE Transactions on Software Engineering, 1991, 17(9): 900-910. doi: 10.1109/32.92910
    [5] PENG C, RAJAN A. Automated test generation for OpenCL kernels using fuzzing and constraint solving[C]//Proceedings of the 13th Annual Workshop on General Purpose Processing Using Graphics Processing Unit. New York: ACM, 2020.
    [6] YANG F, FAN Y, XIAO P, et al. Test data generation method based on multiple convergence direction adaptive PSO[J]. Software Quality Journal, 2022, 31: 279-303.
    [7] 杨波, 吴际, 徐珞, 等. 一种软件测试需求建模及测试用例生成方法[J]. 计算机学报, 2014, 37(3): 522-538.

    YANG B, WU J, XU L, et al. An approach of modeling software testing requirements and generating test case[J]. Chinese Journal of Computers, 2014, 37(3): 522-538(in Chinese).
    [8] BOYER R S, ELSPAS B, LEVITT K N. SELECT—a formal system for testing and debugging programs by symbolic execution[J]. ACM SIGPLAN Notices, 1975, 10(6): 234-245. doi: 10.1145/390016.808445
    [9] MARCINIAK J J. Encyclopedia of software engineering[M]. Hoboken: JohnWiley & Sons, Inc., 2002.
    [10] HARMAN M, MCMINN P. A theoretical & empirical analysis of evolutionary testing and hill climbing for structural test data generation[C]//Proceedings of the 2007 International Symposium on Software Testing and Analysis. New York: ACM, 2007: 73-83.
    [11] METROPOLIS N, ROSENBLUTH A W, ROSENBLUTH M N, et al. Equation of state calculations by fast computing machines[J]. The Journal of Chemical Physics, 1953, 21(6): 1087-1092. doi: 10.1063/1.1699114
    [12] PARGAS R P, HARROLD M J, PECK R R. Test-data generation using genetic algorithms[J]. Software Testing, Verification and Reliability, 1999, 9(4): 263-282. doi: 10.1002/(SICI)1099-1689(199912)9:4<263::AID-STVR190>3.0.CO;2-Y
    [13] LI X L, WONG W E, GAO R Z, et al. Genetic algorithm-based test generation for software product line with the integration of fault localization techniques[J]. Empirical Software Engineering, 2018, 23(1): 1-51. doi: 10.1007/s10664-016-9494-9
    [14] SHEN X J, WANG Q, WANG P P, et al. Automatic generation of test case based on GATS algorithm[C]//2009 IEEE International Conference on Granular Computing. Piscataway: IEEE Press, 2009: 496-500.
    [15] NOSRATI M, HAGHIGHI H, VAHIDI ASL M. Test data generation using genetic programming[J]. Information and Software Technology, 2021, 130: 106446. doi: 10.1016/j.infsof.2020.106446
    [16] SAHOO R R, RAY M. PSO based test case generation for critical path using improved combined fitness function[J]. Journal of King Saud University - Computer and Information Sciences, 2020, 32(4): 479-490. doi: 10.1016/j.jksuci.2019.09.010
    [17] DI NUCCI D, PANICHELLA A, ZAIDMAN A, et al. A test case prioritization genetic algorithm guided by the hypervolume indicator[J]. IEEE Transactions on Software Engineering, 2020, 46(6): 674-696. doi: 10.1109/TSE.2018.2868082
    [18] CAI G C, SU Q H, HU Z B. Automated test case generation for path coverage by using grey prediction evolution algorithm with improved scatter search strategy[J]. Engineering Applications of Artificial Intelligence, 2021, 106: 104454. doi: 10.1016/j.engappai.2021.104454
    [19] GOTLIEB A, BOTELLA B, RUEHER M. Automatic test data generation using constraint solving techniques[J]. ACM SIGSOFT Software Engineering Notes, 1998, 23(2): 53-62. doi: 10.1145/271775.271790
    [20] GUPTA N, MATHUR A P, SOFFA M L. Automated test data generation using an iterative relaxation method[J]. ACM SIGSOFT Software Engineering Notes, 1998, 23(6): 231-244. doi: 10.1145/291252.288321
    [21] WANG C H, PASTORE F, GOKNIL A, et al. Automatic generation of acceptance test cases from use case specifications: An NLP-based approach[J]. IEEE Transactions on Software Engineering, 2022, 48(2): 585-616. doi: 10.1109/TSE.2020.2998503
    [22] BERTOLINO A, MIRANDA B, PIETRANTUONO R, et al. Adaptive test case allocation, selection and generation using coverage spectrum and operational profile[J]. IEEE Transactions on Software Engineering, 2021, 47(5): 881-898. doi: 10.1109/TSE.2019.2906187
    [23] CHEN T Y, LEUNG H, MAK I K. Adaptive random testing[C]//Annual Asian Computing Science Conference. Berlin: Springer, 2004: 320-329.
    [24] CAMPOS J, GE Y, ALBUNIAN N, et al. An empirical evaluation of evolutionary algorithms for unit test suite generation[J]. Information and Software Technology, 2018, 104: 207-235. doi: 10.1016/j.infsof.2018.08.010
    [25] ZAMANI S, HEMMATI H. A cost-effective approach for hyper-parameter tuning in search-based test case generation[C]//2020 IEEE International Conference on Software Maintenance and Evolution. Piscataway: IEEE Press, 2020: 418-429.
    [26] ZAMANI S, HEMMATI H. A pragmatic approach for hyper-parameter tuning in search-based test case generation[J]. Empirical Software Engineering, 2021, 26(6): 1-35.
    [27] YANG B, HE Y Z, LIU H, et al. A lightweight fault localization approach based on XGBoost[C]//2020 IEEE 20th International Conference on Software Quality, Reliability and Security. Piscataway: IEEE Press, 2020: 168-179.
    [28] YANG B, HE Y Z, FENG L X. Automated test case generation for effective spectrum-based fault localization[J]. Journal of Physics: Conference Series, 2020, 1576(1): 012042. doi: 10.1088/1742-6596/1576/1/012042
  • 加载中
图(5) / 表(9)
计量
  • 文章访问数:  333
  • HTML全文浏览量:  106
  • PDF下载量:  43
  • 被引次数: 0
出版历程
  • 收稿日期:  2022-06-22
  • 录用日期:  2022-08-15
  • 网络出版日期:  2022-11-18
  • 整期出版日期:  2023-10-01

目录

    /

    返回文章
    返回
    常见问答