Chaining Test Cases for Reactive System Testing (extended version)

Peter Schrammel, Tom Melham, Daniel Kroening

Abstract

Testing of synchronous reactive systems is challenging because long input sequences are often needed to drive them into a state at which a desired feature can be tested. This is particularly problematic in on-target testing, where a system is tested in its real-life application environment and the time required for resetting is high. This paper presents an approach to discovering a test case chain—a single software execution that covers a group of test goals and minimises overall test execution time. Our technique targets the scenario in which test goals for the requirements are given as safety properties. We give conditions for the existence and minimality of a single test case chain and minimise the number of test chains if a single test chain is infeasible. We report experimental results with a prototype tool for C code generated from Simulink models and compare it to state-of-the-art test suite generators.

Introduction

In safety-critical domains such as automotive and avionics, software is typically implemented as a synchronous reactive system. These systems continuously process inputs and update internal states, often requiring complex sequences of events to reach specific functional states. A major bottleneck in testing these systems on actual hardware (on-target testing) is the "reset tax"—the significant time required to return the system to its initial state between independent test cases.

Figure 1: A state machine representation of a reactive system where test goals are defined as safety properties $p_1$ through $p_4$.

To mitigate this, we propose "test case chaining." Instead of a suite of independent tests, we aim to generate a single, continuous execution sequence that visits multiple test goals, thereby minimizing or eliminating costly resets.

Methodology

Our approach is implemented in a tool called ChainCover, which follows a three-step process:

  1. Abstraction via Property K-Reachability Graph: We represent the system's test goals as nodes in a weighted, directed graph. An edge between two goals indicates that the system can transition from one to the other within $K$ steps. The edge weight represents the minimum number of steps required for this transition.
  2. Optimization via ATSP: Finding the optimal chain is modeled as an Asymmetric Traveling Salesman Problem (ATSP). We seek the shortest path that visits all required nodes (test goals). If a single chain is infeasible, the algorithm minimizes the total number of chains needed.
  3. Concretization via BMC: We use Bounded Model Checking (BMC) to translate the abstract path into concrete input sequences (e.g., specific sensor values or button presses) for the underlying C code.
Figure 2: An example of a Property K-Reachability Graph where nodes represent test goals and edges represent the cost of transitioning between them.

If a proposed path is found to be infeasible during concretization, a refinement loop adjusts the graph constraints until a valid concrete chain is produced.

Experimental Results

We evaluated ChainCover using C code generated from industrial-standard Simulink models, including cruise control systems, window controllers, and car alarms. We compared our tool against FShell, KLEE, and random test generators.

Key findings include:

  • Efficiency: ChainCover consistently produced shorter total test sequences. For instance, in a window controller benchmark, it reduced the sequence from 56 steps (FShell) to 45 steps.
  • Coverage: On complex models like the "Car Alarm," ChainCover achieved full coverage where symbolic execution (KLEE) and random testing timed out.
  • Performance: The optimization step (ATSP) was extremely fast, with over 99% of computation time spent in the BMC backend's SAT solving phase.

Discussion and Future Work

While effective, the approach faces challenges with "deep loops" where logic requires many iterations to trigger. Future improvements could include parallelizing the reachability graph construction—which is "embarrassingly parallel"—and incorporating state invariants to assist the SAT solver. Additionally, developing methods for incremental updates to test chains when code changes would further enhance industrial applicability.

Summary updated

BibTeX
@inproceedings{schrammel2013chaining,
  author = {Peter Schrammel and Tom Melham and Daniel Kroening},
  title = {{Chaining Test Cases for Reactive System Testing (extended version)}},
  booktitle = {ICTSS},
  year = {2013},
  doi = {10.1007/978-3-642-41707-8\_9},
}
Figure