The article studies edge coverage for control flow graphs extended with explicit constraints. Achieving a given level of white-box coverage for a given code is a classic problem in software testing. We focus on designing test sets that achieve edge coverage \textit{while respecting additional constraints} between vertices. The paper analyzes how such constraints affect both the feasibility and computational complexity of edge coverage. The paper discusses five types of constraints. POSITIVE constraints require at least one test path where a given vertex precedes another. NEGATIVE constraints forbid any such test path. ONCE constraints require exactly one test path with a single occurrence of one vertex before another. MAX ONCE constraints allow such precedence in at most one test path. ALWAYS constraints require every test path containing a given vertex to also contain another vertex later on the same path. Each type models a different test requirement, such as mandatory flows, semantic exclusions, or execution cost limits. We investigate the computational complexity of finding a test set that achieves edge coverage and respects a given set of constraints. For POSITIVE constraints, the existence of an edge covering test set is decidable in polynomial time by extending standard edge coverage constructions with additional paths for each constraint. For NEGATIVE, MAX ONCE, ONCE, and ALWAYS constraints, the decision problem is NP-complete. The proofs rely on polynomial reductions from variants of SAT. The NP-completeness results hold even for restricted graph classes, including acyclic graphs, for all these four constraints. Finally, we study the fixed-parameter tractability of the NEGATIVE constraint. Although the general problem is NP-complete, the paper presents an FPT algorithm with respect to the number of constraints.
翻译:本文研究带有显式约束的控制流图的边覆盖问题。为给定代码实现特定级别的白盒覆盖是软件测试中的经典问题。我们专注于设计能够实现边覆盖且同时满足顶点间附加约束的测试集。本文分析了此类约束如何影响边覆盖的可行性和计算复杂性。论文讨论了五种约束类型:POSITIVE约束要求至少存在一条测试路径,其中给定顶点先于另一顶点出现;NEGATIVE约束禁止任何此类测试路径;ONCE约束要求恰好存在一条测试路径,其中某一顶点在另一顶点前仅出现一次;MAX ONCE约束允许此类先后关系至多出现在一条测试路径中;ALWAYS约束要求每条包含给定顶点的测试路径必须在同一路径后续位置包含另一顶点。每种类型对应不同的测试需求,例如强制流程、语义排除或执行成本限制。我们研究了寻找满足边覆盖且遵守给定约束集的测试集的计算复杂性。对于POSITIVE约束,通过扩展标准边覆盖构造方法并为每个约束添加额外路径,可在多项式时间内判定边覆盖测试集的存在性。对于NEGATIVE、MAX ONCE、ONCE和ALWAYS约束,其判定问题均为NP完全问题。证明依赖于从SAT变体的多项式归约。即使对于受限图类(包括无环图),这四类约束的NP完全性结论仍然成立。最后,我们研究了NEGATIVE约束的固定参数可处理性。尽管该问题在一般情况下是NP完全的,本文提出了以约束数量为参数的FPT算法。