Table of Contents
Fetching ...

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

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

TL;DR

This paper reframes basis path generation from a procedural search task into a declarative optimization problem and introduces a Mixed Integer Programming (MIP) framework designed to produce a complete basis path set that is globally optimal in its structural simplicity.

Abstract

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.

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

TL;DR

This paper reframes basis path generation from a procedural search task into a declarative optimization problem and introduces a Mixed Integer Programming (MIP) framework designed to produce a complete basis path set that is globally optimal in its structural simplicity.

Abstract

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.
Paper Structure (31 sections, 9 equations, 2 figures, 3 tables, 1 algorithm)

This paper contains 31 sections, 9 equations, 2 figures, 3 tables, 1 algorithm.

Figures (2)

  • Figure 1: The "Double Diamond" CFG structure. With $|V|=7$ nodes and $|E|=8$ edges, the cyclomatic complexity is $k = 8 - 7 + 2 = 3$. This topology perfectly illustrates the "Greedy Trap": a naive algorithm might select two paths (e.g., $0 \to 1 \to 3 \to 4 \to 6$ and $0 \to 2 \to 3 \to 5 \to 6$) that cover all edges. This makes it impossible to generate a third, linearly independent path, causing the algorithm to fail in producing a complete basis set.
  • Figure 2: The illustrative Control Flow Graph (CFG) used for the qualitative analysis. This graph features a single entry (Node 0) and exit (Node 9) and contains multiple loops and branches, resulting in a cyclomatic complexity ($k$) of 9. It serves as the input for generating the basis path sets compared in Table \ref{['tab:integrated_paths']}.