TL;DR
This paper introduces a novel approach to data flow testing by framing it as a model checking problem. By translating data flow coverage criteria into temporal logic formulas, the authors enable fully automatic test generation using existing model checkers, reducing the complexity of test generation to finding witnesses for these formulas.
What Problem Does This Paper Address?
Traditional data flow testing methods involve modeling software as a control flow graph, performing data flow analysis to identify definition-use associations, and then selecting paths to cover these associations. This process can be complex and labor-intensive, especially for large programs. The challenge lies in automating this test generation process while ensuring that various data flow coverage criteria are met. Existing model checking techniques have been applied to test generation for control flow, but their application to the more intricate data flow testing has been limited.
Methods
The core of this paper's contribution is the formulation of data flow testing as a model checking problem. The authors achieve this by:
- Representing Software as Kripke Structures: Flow graphs, which capture control and data flow, are translated into Kripke structures, the standard input for model checkers.
- Characterizing Coverage Criteria with Temporal Logic: Four established groups of data flow coverage criteria (Rapps and Weyuker, Ntafos, Ural, Laski and Korel) are formally characterized using formulas in Computation Tree Logic (CTL). Specifically, they use a subset of CTL called WCTL (Witnessable CTL), which is designed to have linear witnesses.
- Reducing Test Generation to Witness Finding: The problem of generating test sequences that satisfy a coverage criterion is transformed into the problem of finding witnesses for the corresponding CTL formulas. Model checkers are adept at finding such witnesses (or counterexamples for the negation of a formula).
- Heuristic Algorithms for Minimal Test Suites: Recognizing that finding minimal test suites is computationally hard (NP-hard), the authors propose heuristic algorithms. These algorithms leverage the model checker's ability to find counterexamples to construct witnesses, aiming to minimize the number and length of generated test sequences by removing redundant ones.
Datasets
Not discussed in the paper. The authors use a sample flow graph (Figure 1) for illustration and refer to a flow graph from Ural et al. [31] for experimental evaluation.
Key Insights and Ideas
- Model Checking as a Unified Framework: Model checking provides a powerful, unified framework for automating data flow test generation, abstracting away much of the complexity of traditional methods.
- Temporal Logic for Expressing Coverage: CTL (and its subset WCTL) is expressive enough to formally define various data flow coverage criteria, making them amenable to automated verification.
- Witnesses as Test Sequences: The direct correspondence between a witness for a temporal logic formula and a test sequence covering a specific data flow entity is a key insight.
- Complexity of Minimality: The paper formally establishes that generating minimal cost test suites (in terms of the number of sequences or total length) is NP-hard, justifying the need for heuristic approaches.
- Language Independence: The approach is largely language-independent, as the temporal logic formulas operate on abstract flow graphs, which can be derived from various programming languages and specification formalisms.
Key Results
- The paper successfully demonstrates how to translate data flow coverage criteria into WCTL formulas.
- It shows that test generation can be fully automated by leveraging model checkers to find witnesses for these formulas.
- The authors present heuristic algorithms for generating minimal cost test suites, which are shown to be effective in reducing the number of test sequences.
- Experimental results on a moderate-sized flow graph (39 vertices, 46 arcs, 24 definitions, 36 uses) indicate that the heuristic approach significantly reduces the number of test sequences (e.g., from 53 to 14 for all-uses coverage) with a manageable increase in execution time.
Limitations and Future Work
- Infinite State Spaces: While the flow graph approach can handle infinite state spaces (unlike reachability graph approaches), it requires posterior analysis (symbolic execution or constraint solving) to determine test executability and variable values.
- Constructing All Witnesses: Extending model checkers to construct all witnesses for a given formula, or a subset satisfying specific constraints, is an open problem, particularly for criteria like all-du-paths.
- More Powerful Logics: For certain criteria (like Ural's), a more expressive logic than WCTL (specifically, alternation-free mu-calculus) is needed, which the authors are exploring.
- Interprocedural and Object-Oriented Programs: Future work includes extending the approach to handle interprocedural programs and object-oriented programs, which present additional complexities.
- Real-World Applications: The authors are actively working on applying this model checking-based approach to real-world applications, including test generation from statecharts and communicating state machines.
Summary updated