电子学报 ›› 2022, Vol. 50 ›› Issue (7): 1696-1707.DOI: 10.12263/DZXB.20210953

• 学术论文 • 上一篇    下一篇

利用函数影响力的相似程序间测试用例重用与生成

钱忠胜, 宋佳, 俞情媛, 成轶伟, 孙志旺   

  1. 江西财经大学信息管理学院,江西 南昌 330013
  • 收稿日期:2021-07-20 修回日期:2021-10-02 出版日期:2022-07-25
    • 作者简介:
    • 钱忠胜 男,1977年1月出生,江西鹰潭人.2008年在上海大学获工学博士学位.江西财经大学教授,博士生导师.主要研究方向为软件工程、机器学习、智能化软件等.E-mail: changesme@163.com
      宋 佳 女,1997年6月出生,四川眉山人.江西财经大学信息管理学院硕士研究生.主要研究方向为软件工程、智能推荐系统等.
      宋佳 女,1997年6月出生,四川眉山人.江西财经大学信息管理学院硕士研究生. 主要研究方向为软件工程、智能推荐系统等.
    • 基金资助:
    • 国家自然科学基金 (61762041); 江西省自然科学基金 (20181BAB202009)

Test Case Reuse and Generation Between Similar Programs Based on Function Influence

QIAN Zhong-sheng, SONG Jia, YU Qing-yuan, CHENG Yi-wei, SUN Zhi-wang   

  1. School of Information Management, Jiangxi University of Finance & Economics, Nanchang, Jiangxi 330013, China
  • Received:2021-07-20 Revised:2021-10-02 Online:2022-07-25 Published:2022-07-30
    • Supported by:
    • National Natural Science Foundation of China (61762041); Natural Science Foundation of Jiangxi Province, China (20181BAB202009)

摘要:

在回归测试过程中,用例重用是一项很重要的工作,其充分利用软件升级变更前的已有资源,提高测试的效率.从已有研究来看,回归测试的研究大部分侧重于用例优化方面,少部分提到利用程序升级变更前后的相似性来重用测试用例以提高用例生成效率.针对回归测试用例重用问题,提出一种重用变更前相似程序的测试信息,并通过设计的适应度函数为变更后程序进化生成新用例的方法.该方法利用构建的函数调用图进行程序相似部分的检测,并根据函数影响力设计适应度函数来调整个体的适应度值,保留适应度值高的优秀个体;再通过重用变更前相似部分的用例,以及进化生成的变更后的部分用例,来构成回归测试中新程序的用例.实验结果表明,在目标路径覆盖率上,对于中小规模和大规模工业程序,本文方法比经典方法分别可提高8%和17%.

关键词: 测试用例, 程序相似性, 函数影响力, 关键函数, 回归测试

Abstract:

In the process of regression testing, the reuse of test cases is a critical activity. It makes full use of the resources before updating the software to improve the efficiency of software testing. According to the existing results, most of them on regression testing focus on the test case prioritization, and a few mention the use of similarity before and after the programs upgrade changes to reuse test cases to improve the efficiency of test case generation. Aiming at the test case reuse in regression testing, this paper proposes an approach to reuse test data of similar programs before the change, and employs the fitness function designed to evolve to generate new test cases for the program after the change. It utilizes the function call graph constructed to detect similar parts of the programs. And according to the function influence, the fitness function is designed to adjust the fitness value of the individual, and excellent individuals with high fitness value are retained. Then, it reuses the test cases of the similar part before the change and the part of the test cases generated in the evolutionary process after the change, to form the test cases of the new program in the regression test. The experimental results show that, compared to the classical methods, the target path coverage rate of the proposed method is increased by 8% and 17% for small- and medium-sized, and large-sized industrial programs, respectively.

Key words: test case, program similarity, function influence, key function, regression test

中图分类号: