结合K-means与SVR的多路径覆盖测试用例约简与生成
CSTR:
作者:
作者单位:

作者简介:

通讯作者:

中图分类号:

TP311

基金项目:

国家自然科学基金(62262025); 赣鄱俊才支持计划主要学科学术和技术带头人培养项目 (20243BCE51024); 江西省自然科学基金重点项目(20224ACB202012)


Test Case Reduction and Generation of Multi-path Coverage Based on K-means and SVR
Author:
Affiliation:

Fund Project:

  • 摘要
  • |
  • 图/表
  • |
  • 访问统计
  • |
  • 参考文献
  • |
  • 相似文献
  • |
  • 引证文献
  • |
  • 资源附件
  • |
  • 文章评论
    摘要:

    结合机器学习相关技术的启发式测试用例生成方法可显著提高测试效率. 已有研究关注于利用部分测试用例构建高效的代理模型, 忽略了初始种群质量以及代理模型对多路径测试效率的影响. 由此, 提出一种结合K-means与SVR (support vector machine regression, 支持向量机回归)的测试用例约简与生成方法. 通过K-means将随机生成的用例聚为若干簇, 保留与簇中心距离在一定阈值内的用例, 生成这些用例的路径覆盖矩阵. 利用该矩阵评估测试用例的路径覆盖潜能以及路径的难易覆盖程度, 并基于这两者对测试用例进行排序, 分别从不同簇中选取若干用例构成测试用例约简集, 将其作为初始遗传种群. 这不仅增强初始种群的多样性, 降低其冗余性, 还有助于减少多路径覆盖的测试用例进化次数. 同时, 将聚类前的用例及其适应度作为样本训练适应于多路径覆盖的SVR适应度预测模型, 并使用遗传进化生成的新用例更新模型, 进一步提高模型精度, 可减少执行插桩程序带来的大量时间消耗. 这样, 种群质量与测试效率均得以提升. 实验表明, 在15个程序上, 所提方法在覆盖率、平均进化代数等指标上均有较好改善. 其中在覆盖率上, 与3类基准方法相比, 最少可提高7%, 最多可达49%; 与5种具有竞争性的方法相比, 可提高约10%, 最多可达25%. 所提方法对融合机器学习的多路径测试研究提供了方法指导.

    Abstract:

    The heuristic test case generation method that combines machine learning-related technologies can significantly improve the test efficiency. Existing studies focus on building efficient surrogate models with partial test cases, but ignore the influence of both the initial population quality and surrogate models on the multi-path testing efficiency. Therefore, this study proposes a test case reduction and generation method combining K-means and support vector machine regression (SVR). The randomly generated test cases are clustered into several clusters by adopting K-means, and only the test cases that are within a particular distance away from the cluster center are retained, with the path coverage matrix for these test cases constructed. This matrix is employed to evaluate the path coverage potential of test cases and the coverage difficulty of paths. Additionally, based on these two conditions, the test cases are ranked, and several test cases are selected from different clusters to construct the test case reduction set, which is taken as the initial genetic population. This not only increases the diversity of the initial population and reduces its redundancy, but also helps to reduce the iteration number for multi-path coverage test cases. Meanwhile, the test cases before clustering and their fitness are employed as the samples to train the SVR fitness prediction model designed for multi-path coverage, and then the new test cases generated by genetic evolution are utilized to update the model, thus improving the model accuracy and reducing the time consumed due to the instrumentation program execution. In this way, both population quality and test efficiency can be improved. The experimental results show that on fifteen programs, the proposed method has better improvements in terms of indicators such as the coverage rate and average evolutionary generation. Specifically, in terms of the coverage rate, the proposed method demonstrates an improvement of at least 7% and up to 49% compared to three types of baseline methods, and shows the enhancement of approximately 10% to a maximum of 25% compared to five competitive methods. The proposed method provides guidance for the research on multi-path testing that combines machine learning.

    参考文献
    相似文献
    引证文献
引用本文

钱忠胜,俞情媛,范赋宇,许克文,陈超.结合K-means与SVR的多路径覆盖测试用例约简与生成.软件学报,,():1-26

复制
相关视频

分享
文章指标
  • 点击次数:
  • 下载次数:
  • HTML阅读次数:
  • 引用次数:
历史
  • 收稿日期:2024-10-03
  • 最后修改日期:2025-03-25
  • 录用日期:
  • 在线发布日期: 2026-01-21
  • 出版日期:
文章二维码
您是第位访问者
版权所有:中国科学院软件研究所 京ICP备05046678号-3
地址:北京市海淀区中关村南四街4号,邮政编码:100190
电话:010-62562563 传真:010-62562533 Email:jos@iscas.ac.cn
技术支持:北京勤云科技发展有限公司

京公网安备 11040202500063号