arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2601.05463cs.SE
收藏

重新思考基础路径测试:用于测试路径集生成的混合整数规划方法

Rethinking Basis Path Testing: Mixed Integer Programming Approach for Test Path Set Generation

Hubei University of Technology(湖北工业大学)

Chao Wei, Xinyi Peng, Yawen Yan, Mao Luo, Ting Cai

AI总结:

本文提出基于混合整数规划的方法,用于生成完整的基础路径集,通过全局优化和增量策略提升测试路径生成的效率和效果。

摘要:

基础路径测试是结构测试的基石,然而传统自动化方法依赖于贪心图遍历算法(例如DFS/BFS),往往生成次优路径。这种结构性劣势并非无关紧要的问题;它直接阻碍了后续的测试活动,通过复杂化自动化测试数据生成并增加人类工程师的认知负荷。本文将基础路径生成从一种过程搜索任务重新定义为一种声明性优化问题。我们介绍了一种混合整数规划(MIP)框架,旨在生成一个完整的基础路径集,其在结构性简洁性上是全局最优的。我们的框架包括两种互补的策略:一种是保证理论上最优路径集的全局MIP模型,以及一种可扩展的增量MIP策略,用于大型复杂拓扑结构。增量方法特征一个多目标函数,优先考虑路径简洁性,并纳入新颖性惩罚以最大化生成线性无关路径的成功率。在真实代码和大规模合成控制流图上的实证评估表明,我们的增量MIP策略在生成完整基础集方面实现了100%的成功率,同时保持了计算效率。我们的工作提供了一种生成高质量结构“骨架”的基础方法,可以增强后续测试生成工作的效率和效果。

英文摘要:

Basis path testing is a cornerstone of structural testing, yet traditional automated methods, relying on greedy graph-traversal algorithms (e.g., DFS/BFS), often generate sub-optimal paths. This structural inferiority is not a trivial issue; it directly impedes downstream testing activities by complicating automated test data generation and increasing the cognitive load for human engineers. This paper reframes basis path generation from a procedural search task into a declarative optimization problem. We introduce a Mixed Integer Programming (MIP) framework designed to produce a complete basis path set that is globally optimal in its structural simplicity. Our framework includes two complementary strategies: a Holistic MIP model that guarantees a theoretically optimal path set, and a scalable Incremental MIP strategy for large, complex topologies. The incremental approach features a multi-objective function that prioritizes path simplicity and incorporates a novelty penalty to maximize the successful generation of linearly independent paths. Empirical evaluations on both real-code and large-scale synthetic Control Flow Graphs demonstrate that our Incremental MIP strategy achieves a 100\% success rate in generating complete basis sets, while remaining computationally efficient. Our work provides a foundational method for generating a high-quality structural "scaffold" that can enhance the efficiency and effectiveness of subsequent test generation efforts.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑