We present a novel approach to test-case generation that satisfies four white-box, path-based coverage criteria: Prime Path, Simple Cycle, Simple Path, and Edge-Acyclic Path. Our method builds on a modified version of Johnson algorithm and enables test cases to be generated incrementally and on demand, rather than requiring the entire test suite to be computed upfront. This streaming capability represents a substantial advancement over existing approaches, as it allows testers to begin executing and refining tests immediately, thereby significantly improving the efficiency of test design. Our solution is inherently memory efficient, as it does not store all discovered coverage items; instead, it retains only the minimal set of paths required to generate subsequent coverage items on the fly. As a result, the approach scales to arbitrarily large graphs. In addition, the algorithm gives testers explicit control over the size of the generated test suite by allowing them to restrict the number of cycles permitted in a test path. The approach is grounded in new theoretical insights, most notably a novel characterization of prime paths in terms of the strongly connected components of control-flow graphs. We complement these theoretical contributions with a practical implementation and a comprehensive empirical evaluation. The results demonstrate that our method not only outperforms existing techniques in terms of execution time and memory consumption, but also provides testers with a more flexible and efficient tool for achieving high coverage while substantially reducing test design overhead.
翻译:本文提出了一种新颖的测试用例生成方法,可满足四种基于路径的白盒覆盖准则:主路径、简单循环、简单路径和边无环路径。该方法基于改进版的Johnson算法,支持按需增量生成测试用例,无需预先计算完整的测试套件。这种流式处理能力相较于现有方法具有显著进步,使测试人员能够立即开始执行和优化测试,从而大幅提升测试设计效率。本方案具有固有的内存高效性,无需存储所有已发现的覆盖项,仅保留动态生成后续覆盖项所需的最小路径集合,因此可扩展至任意规模的图结构。此外,该算法允许测试人员通过限制测试路径中的循环数量,显式控制生成测试套件的规模。该方法基于新的理论洞见,其中最突出的是通过控制流图的强连通分量对主路径进行的新颖表征。我们在理论贡献基础上提供了实际实现和全面的实证评估。结果表明,该方法不仅在执行时间和内存消耗方面优于现有技术,还为测试人员提供了更灵活高效的工具,在显著降低测试设计开销的同时实现高覆盖率。