电子学报 ›› 2023, Vol. 51 ›› Issue (2): 455-466.DOI: 10.12263/DZXB.20210688

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

基于深度强化学习的类集成测试序列生成方法

张颖辉1,2, 张艳梅1,2,3, 张志成4, 姜淑娟1,2, 丁艳茹1,2, 袁冠1,2,3   

  1. 1.中国矿业大学矿山数字化教育部工程研究中心,江苏徐州 221116
    2.中国矿业大学计算机科学与技术学院,江苏徐州 221116
    3.广西可信软件重点实验室(桂林电子科技大学),广西桂林541004
    4.南方科技大学工学院计算机科学与工程系,广东深圳 518055
  • 收稿日期:2021-05-08 修回日期:2022-05-31 出版日期:2023-02-25
    • 作者简介:
    • 张颖辉 男,1996年生,河南商丘人. 中国矿业大学计算机科学与技术硕士研究生.主要研究方向为类集成测试序列生成、深度强化学习.
      张艳梅(通讯作者) 女,1982年生,唐山人.博士,中国矿业大学计算机科学与技术学院副教授.主要研究方向为软件分析与测试、强化学习.E-mail: ymzhang@cumt.edu.cn
      张志成 男,1998年生,湖北宜昌人. 南方科技大学工学院计算机科学与工程系硕士研究生.主要研究方向为自动程序修复、移动应用分析与软件测试.
      姜淑娟 女,1966年生,山东莱阳人.博士,中国矿业大学教授、博士生导师.主要研究方向为软件分析与测试、缺陷预测、故障定位、进化计算等.E-mail: shjjiang@cumt.edu.cn
      丁艳茹 女,1996年生,河北沧州人.中国矿业大学计算机科学与技术学院博士研究生.主要研究方向为软件分析与测试,强化学习.E-mail: yrding@cumt.edu.cn
      袁 冠 男,1982年生,江苏睢宁人.博士,中国矿业大学教授、博士生导师.主要研究方向为时空大数据技术以及计算智能等.E-mail: yuanguan@cumt.edu.cn
    • 基金资助:
    • 国家自然科学基金(61673384);中国博士后基金特别资助(2021T140707);广西可信软件重点实验室研究课题(kx201609)

Generation Method of Class Integration Test Order Based on Deep Reinforcement Learning

ZHANG Ying-hui1,2, ZHANG Yan-mei1,2,3, ZHANG Zhi-cheng4, JIANG Shu-juan1,2, DING Yan-ru1,2, YUAN Guan1,2,3   

  1. 1.Mine Digitization Engineering Research Center of the Ministry of Education, China University of Mining and Technology, Xuzhou, Jiangsu 221116, China
    2.School of Computer Science and Technology, China University of Mining and Technology, Xuzhou, Jiangsu 221116, China
    3.Guangxi Key Laboratory of Trusted Software, Guilin, Guangxi 541004, China
    4.Department of Computer Science and Engineering, College of Engineering, Southern University of Science and Technology, Shenzhen, Guangdong 518055, China
  • Received:2021-05-08 Revised:2022-05-31 Online:2023-02-25 Published:2023-04-14
    • Supported by:
    • National Natural Science Foundation of China(61673384);Postdoctoral Foundation of China(2021T140707);Guangxi Trusted Software Key Laboratory(kx201609)

摘要:

类集成测试序列的生成是面向对象软件测试中的关键步骤,当类的测试序列不同时,相应的测试代价也不相同.在集成测试中生成一个合理的类集成测试序列可以有效降低软件测试的代价.本文将深度强化学习中的Advantage Actor-Critic算法应用于解决类集成测试序列生成问题.首先,利用类间各种依赖关系构建与智能体交互的环境模型;然后,记录智能体从初始状态到终止状态的路径,即每次选择的动作对应每次选择集成到序列的类编号;最后,得出最终的类集成测试序列.实验结果表明,本文方法所得到的类集成测试序列花费的总体测试桩复杂度,在选取的7个项目中有5个表现最佳,在剩余2个项目中表现中等.

关键词: 集成测试, 测试序列, 深度强化学习, advantage actor-critic, 测试桩复杂度

Abstract:

The generation of class integration test order is the key step in object-oriented software testing. When the class integration test order is different, the corresponding test cost is different. Generating a reasonable class integration test order in integration testing can effectively reduce the cost of software testing. This paper applies the advantage actor-critic algorithm in deep reinforcement learning to solve the problem of class integration test order generation. Firstly, the environment model of interaction with agents is constructed by using various dependencies between classes. Then, the path of the agent from the initial state to the termination state is recorded, that is, each selected action corresponds to each selected class number integrated into the order. Finally, the final class integration test order is obtained. The experimental results show that the total test stubs complexity of class integration test order cost obtained by the method in this paper has the best performance in 5 out of 7 selected subjects, and the average performance in the remaining 2 subjects.

Key words: integration test, test order, deep reinforcement learning, advantage actor-critic, complexity

中图分类号: