《计算机应用》唯一官方网站 ›› 2023, Vol. 43 ›› Issue (1): 221-226.DOI: 10.11772/j.issn.1001-9081.2021112015

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

基于历史数据和多目标优化的测试用例排序方法

李兴佳, 杨秋辉, 洪玫, 潘春霞, 刘瑞航   

  1. 四川大学 计算机学院,成都 610065
  • 收稿日期:2021-11-28 修回日期:2022-05-01 发布日期:2022-05-24
  • 作者简介:李兴佳(1997—),男,河北石家庄人,硕士研究生,主要研究方向:软件质量保证与测试;杨秋辉(1970—),女,山东青岛人,副教授,博士,主要研究方向:软件自动化测试、软件项目管理;洪玫(1963—),女,浙江舟山人,教授,硕士,CCF高级会员,主要研究方向:软件分析与测试 email:hongmei@scu.edu.cn;潘春霞(1995—),女,四川内江人,硕士,主要研究方向:软件质量保证与测试;刘瑞航(1998—),男,黑龙江哈尔滨人,硕士研究生,主要研究方向:移动应用质量保证与测试;

Test case prioritization approach based on historical data and multi-objective optimization

LI Xingjia, YANG Qiuhui, HONG Mei, PAN Chunxia, LIU Ruihang   

  1. College of Computer Science, Sichuan University, Chengdu Sichuan 610065, China
  • Received:2021-11-28 Revised:2022-05-01 Online:2022-05-24
  • Contact: HONG Mei, born in 1963, M. S., professor. Her research interests include software analysis and testing.
  • About author:LI Xingjia, born in 1997, M. S. candidate. His research interests include software quality assurance and testing;YANG Qiuhui, born in 1970, Ph. D., associate professor. Her research interests include software automatic testing, software project management;PAN Chunxia, born in 1995, M. S. Her research interests include software quality assurance and testing;LIU Ruihang, born in 1998, M. S. candidate. His research interests include mobile application quality assurance and testing;

摘要: 针对如何提高测试用例序列的揭错效率和回归测试效益问题,提出一种基于历史数据和多目标优化的测试用例排序方法。首先,根据测试用例的文本主题相似性和代码覆盖相似性对测试用例集进行聚类,并根据历史执行信息对测试用例间的执行失败关系进行关联规则挖掘,从而为后续过程做准备;然后,利用多目标优化算法对每个类簇内的测试用例进行排序,在此之后生成最终排序序列,使相似的测试用例分隔开;最后,利用测试用例间的关联规则,动态调整测试用例执行次序,从而使可能失败的测试用例优先执行,以进一步提高缺陷检测效率。与随机排序方法、基于聚类的排序方法、基于主题模型的排序方法、基于关联规则和多目标优化的排序方法相比,所提方法的平均故障检测率(APFD)平均值分别提高了12.59%、5.98%、3.01%和2.95%,基于成本的平均故障检测率(APFDc)平均值分别提高了17.17%、5.04%、5.08%和8.21%。实验结果表明,所提方法能有效提高回归测试效益。

关键词: 回归测试, 测试用例聚类, 关联规则挖掘, 测试用例排序, 多目标优化

Abstract: To improve the error detection efficiency and the benefit of regression testing of test case sequence, a test case prioritization approach based on historical data and multi-objective optimization was proposed. Firstly, the test case set was clustered according to the text topic similarity and code coverage similarity of test cases, and the association rules were mined for execution failure relationships between test cases according to the historical execution information, thereby preparing for the subsequent process. Then, the multi-objective optimization algorithm was used to sort the test cases in each cluster. After that, the final sorting sequence was generated to separate the similar test cases. Finally, the association rules between test cases were used to dynamically adjust the execution order of test cases, so that the test cases that may fail were executed with priority, so as to further improve the efficiency of defect detection. Compared with random search approach, the approach based on clustering, the approach based on topic model, the approach based on association rules and multi-objective optimization, the proposed approach has the average value of Average Percentage of Faults Detected (APFD) increased by 12.59%, 5.98%, 3.01% and 2.95%, respectively, and has the average value of APFD cost-cognizant (APFDc) increased by 17.17%, 5.04%, 5.08% and 8.21%, respectively. Experimental results show that the proposed approach can improve the benefit of regression testing effectively.

Key words: regression test, test case clustering, association rule mining, test case prioritization, multi-objective optimization

中图分类号: