Page 164 - 《软件学报》2026年第5期
P. 164

软件学报 ISSN 1000-9825, CODEN RUXUEW                                        E-mail: jos@iscas.ac.cn
                 2026,37(5):2043−2062 [doi: 10.13328/j.cnki.jos.007436] [CSTR: 32375.14.jos.007436]  http://www.jos.org.cn
                 ©中国科学院软件研究所版权所有.                                                          Tel: +86-10-62562563



                                                                      *
                 面向两阶段分组的测试用例优先级排序方法

                 钱忠胜,    秦朗悦,    范赋宇,    付庭峰


                 (江西财经大学 计算机与人工智能学院, 江西 南昌 330032)
                 通信作者: 钱忠胜, E-mail: changesme@163.com

                 摘 要: 测试用例优先级排序方法          TCP  在缓解测试开销方面备受关注. 基于不同优先级策略的贪心算法是                     TCP  中
                 常用的方法. 然而, 现有基于贪心算法的           TCP  技术多使用单一的排序策略, 且每轮迭代排序过程一次性考虑全部测
                 试用例, 而未关注用例间的关系, 导致在覆盖信息和排序方面的处理上耗时过长, 极大地降低了排序效率. 同时, 在
                 单一的排序策略中, Additional 策略得到广泛研究, 但其受随机因素影响较大, 当出现平局时, 通常会随机选择待排
                 用例, 影响排序的有效性. 基于此, 提出一种面向两阶段分组的测试用例优先级排序方法                          TPG-TCP. 第  1  阶段进行
                 粗粒度测试用例分组, 通过挖掘用例间的隐藏关系, 将它们分为关键用例组和普通用例组, 为下一阶段采用多样性
                 策略排序做准备, 以提高排序效率. 第           2  阶段进行细粒度测试用例分组排序, 根据迭代次数将关键用例分组, 为减
                 少  Additional 策略中随机因素的干扰, 提出基于用例潜力度的            TP-Additional 策略对一部分关键用例排序, 同时采
                 用简单高效的     Total 策略对普通用例与另一部分关键用例排序, 将排序结果追加至                   TP-Additional 策略的排序结果
                 中, 在排序有效性提升的同时也提高了效率. 通过与               8  种相关方法在    6  个数据集上的对比结果发现, 所提方法是高
                 效且可行的, 在    APFD  与  TETC  指标上分别平均提升约     1.29%  和  9.54%.
                 关键词: 测试用例优先级排序; 两阶段分组; 贪心算法; Additional 策略
                 中图法分类号: TP311


                 中文引用格式: 钱忠胜, 秦朗悦, 范赋宇, 付庭峰. 面向两阶段分组的测试用例优先级排序方法. 软件学报, 2026, 37(5): 2043–2062.
                 http://www.jos.org.cn/1000-9825/7436.htm
                 英文引用格式: Qian ZS, Qin LY, Fan FY, Fu TF. Test Case Prioritization Approach Based on Two-phase Grouping. Ruan Jian Xue
                 Bao/Journal of Software, 2026, 37(5): 2043–2062 (in Chinese). http://www.jos.org.cn/1000-9825/7436.htm
                 Test Case Prioritization Approach Based on Two-phase Grouping

                 QIAN Zhong-Sheng, QIN Lang-Yue, FAN Fu-Yu, FU Ting-Feng
                 (School of Computer and Artificial Intelligence, Jiangxi University of Finance and Economics, Nanchang 330032, China)
                 Abstract:  Test  case  prioritization  (TCP)  has  gained  significant  attention  due  to  its  potential  to  reduce  testing  costs.  Greedy  algorithms
                 based  on  various  prioritization  strategies  are  commonly  used  in  TCP.  However,  most  existing  greedy  algorithm-based  TCP  techniques  rely
                 on  a  single  prioritization  strategy  and  process  all  test  cases  simultaneously  during  each  iteration,  without  considering  the  relationships
                 between  test  cases.  This  results  in  excessive  computational  overhead  when  handling  coverage  information  and  performing  prioritization,
                 thus reducing overall efficiency. Among single-strategy approaches, the Additional strategy has been extensively studied but remains highly
                 sensitive  to  random  factors.  When  a  tie  occurs,  test  cases  are  typically  selected  at  random,  compromising  prioritization  effectiveness.  To
                 address  these  issues,  a  test  case  prioritization  approach  based  on  two-phase  grouping  (TPG-TCP)  is  proposed.  In  the  first  phase,  coarse-
                 grained  grouping  is  conducted  by  mining  hidden  relationships  among  test  cases,  thus  dividing  them  into  a  key  group  and  an  ordinary
                 group. This lays the groundwork for applying diversity-based strategies in the next phase to enhance prioritization efficiency. In the second


                 *    基金项目: 国家自然科学基金  (62262025); 赣鄱俊才支持计划主要学科学术和技术带头人领军人才项目 (20243BCE51024); 江西省自然
                  科学基金重点项目     (20224ACB202012)
                  收稿时间: 2024-12-04; 修改时间: 2025-02-02; 采用时间: 2025-03-23; jos 在线出版时间: 2025-07-30
                  CNKI 网络首发时间: 2025-07-31
   159   160   161   162   163   164   165   166   167   168   169