- The paper introduces quantum-specific probabilistic metrics for condition, decision, and path coverage to more accurately assess test adequacy in circuit-based quantum programs.
- It presents a toolchain, QaCoCo, which instruments quantum circuits by decomposing controlled gates and monitoring qubit states without disrupting computations.
- Empirical results show high raw structural coverage with default inputs but reveal significant imbalances in probabilistic path coverage, indicating untested execution paths.
Quantum-Specific Condition, Decision, and Path Coverage for Circuit-Based Programs
Introduction and Motivation
The problem of defining and measuring test adequacy in quantum software is fundamentally different from classical computing due to the inherent probabilistic nature, entanglement, and the unobservable intermediate state behavior of quantum circuits. In classical software engineering, structural coverage criteria such as line, branch (decision), and path coverage are the mainstay for evaluating test thoroughness, guiding test generation, and indicating confidence in implementation correctness. These metrics, however, do not directly translate to quantum programming, where programs are predominantly straight-line code (as quantum circuits), and classical branching is often absent. Consequently, line coverage is trivially maximized, and traditional coverage reports fail to identify gaps in quantum program testing.
To fill this gap, the authors of "Probabilistic Condition, Decision and Path Coverage of Circuit-based Quantum Programs" (2604.26609) systematically adapt and redefine these coverage criteria for quantum circuits, introducing probabilistic analogs that quantify both the structural exploration and confidence (via fairness measures) in the achieved coverage. Their innovations are encapsulated and empirically evaluated in QaCoCo, a tool designed to instrument, execute, and assess OpenQASM and Qiskit-based quantum programs.
Quantum Coverage Criteria and Instrumentation
Redefining Control Flow for Quantum Circuits
Classical coverage focuses on executable statements and explicit branching. Quantum circuits, however, induce “branching” structurally via controlled gates (e.g., CX, CSwap, CCX), where operations are contingent on the quantum state of control qubits rather than deterministic conditions. Therefore, the quantum analogs to classical decisions are controlled-gate activations, while the analog to classical conditions are the particular qubit state combinations leading to these activations.
The authors formalize six criteria—condition, decision, and path coverage, and their probabilistic variants. The definitions are as follows:
- Condition Coverage: Ensures each internal condition (i.e., each CX gate’s control qubit state in a transpiled higher-level controlled gate) is observed to both activate and not activate at least once.
- Decision Coverage: Ensures that each controlled gate as a whole is observed to activate and not activate during execution.
- Path Coverage: Ensures all possible combinations of the internal conditions are exercised.
QaCoCo instruments quantum programs at the circuit level, focusing exclusively on controlled gates as proxies for branching structure. The tool performs two main phases:
- Transpilation: Complex controlled gates (e.g., CSWAP) are decomposed to primitive CX operations using the Qiskit transpiler. This exposes explicit control dependencies akin to “if” statements.
- Instrumentation: Since direct qubit measurement collapses quantum states and disrupts computations, the tool injects “save_expectation_value” and “save_probabilities” instructions (Qiskit Aer simulator primitives) to monitor control qubit states without measurement—extracting expectation and probability distributions at the relevant execution points.
This combination allows precise, simulator-based introspection of structural behavior without altering computation outcomes, as illustrated in the instrumented Swap test circuit, where instrumentation tracks each control qubit’s superposition or collapse throughout the execution.

Figure 1: Original, transpiled, and instrumented circuit of the Swap test written in Qiskit, visualizing the circuit transformation pipeline for coverage computation.
Probabilistic Coverage: Quantifying Test Confidence
Because quantum program execution is inherently probabilistic, observed “coverage” in a single shot may misleadingly imply completeness. To address this, each structural coverage criterion is paired with a probabilistic metric: each is multiplied by Jain’s fairness index over witnessed outcomes, reflecting how uniformly the different branches/paths are exercised.
For example, 100% decision coverage may be attained if a control qubit is in a superposition, but this coverage is only representative if both outcomes are taken with high probability. Probabilistic coverage thus refines raw coverage reports with a scalar capturing the confidence in actually testing all “logical” branches, distinguishing between balanced exploration versus pathological cases where rare or unbalanced events yield a misleading 100%.
Empirical Analysis
Experimental Setup
QaCoCo’s effectiveness and efficiency were assessed over 540 quantum circuits (a subset drawn from 1,943 circuits in MQT~Bench suitable for simulator-based instrumentation and execution) spanning 29 quantum algorithms.
- RQ1: Measures instrumentation cost.
- RQ2: Assesses runtime and size overhead.
- RQ3: Evaluates coverage obtained by default (“all-zero”) initializations.
- RQ4: Correlates structural coverage with fault-detection capability (via statevector-based mutation analysis).
Key Numerical Results
- Instrumentation: QaCoCo instruments most circuits in under 30 seconds; runtime is strongly correlated with number of controlled gates and circuit size.
- Overhead: Instrumented circuits increase in file size by ≈4.7x and take ≈12x longer to simulate on average (though most run in under a minute, with some large, deep circuits dominating the tail of the distribution).
- Coverage: Default (all-zeros) inputs achieve high mean coverage—97.56% for condition and 97.63% for decision; path coverage is lower at 71.84%, especially in the presence of multi-controlled gates (mean drops to 49.82% for these circuits).
- Probabilistic Coverage: The mean probabilistic coverage (confidence-weighted) for condition and decision is ≈88%, and only ≈37% for path—a significant reduction from the raw path coverage, reflecting imbalance in actual path exploration.
- Mutation Testing Correlation: The correlation between structural coverage metrics and mutation score is weak (Spearman’s ρ ≈ 0.33), consistent with classical SE literature, indicating that coverage is not a direct proxy for fault revelation.
Implications and Future Perspectives
The quantum-specific coverage criteria significantly improve the interpretability and informativeness of test suites for circuit-based quantum programs. By focusing on controlled gates, the proposed metrics expose untested control structures and help identify cases where apparent completeness (e.g., 100% coverage) is numerically unjustified due to probabilistic imbalances.
Practical Implications:
- Testing Guidance: Structural and probabilistic coverage jointly identify untested decision points and suggest the need for more targeted or diversified input states, especially for complex multi-control scenarios.
- Tooling: Although current support is simulator-centric (Qiskit Aer), this methodology lays the groundwork for approximate, hardware-backed coverage estimation—albeit statistical rather than exact, due to the constraints imposed by quantum measurement and the no-cloning theorem.
Limitations:
- Coverage metrics are backend- and transpiler-specific.
- For large circuits, both instrumentation and simulation may be prohibitively expensive.
- The correspondence between coverage and bug revelation is not direct; coverage is a necessary but not sufficient test adequacy criterion.
Theoretical Implications and Future Work:
- The methodology suggests generalizing and combining classical adequacy concepts (e.g., MC/DC criteria) for quantum contexts.
- Integration with input-generation techniques (e.g., QuraTest, NovaQ) and circuit partitioning strategies (e.g., CutQC) can further improve test efficiency.
- Investigation into structural coverage for dynamic, non-circuit-based quantum languages remains open.
Conclusion
This work establishes clear, actionable analogs for condition, decision, and path coverage for quantum circuits, and for the first time, augments these with probabilistic confidence via fairness metrics. The empirical evidence demonstrates that, while classical input configurations perform well structurally, substantial path coverage gaps and probabilistic imbalances exist, especially in circuits featuring multi-controlled gates. The resulting methodology and QaCoCo tool represent a significant advance in principled quantum software testing, enabling developers and researchers to reason about test adequacy with rigor and nuance, and to guide future work in quantum program analysis and test automation.