A Large-Scale Dynamic Characterization of Flaky Tests in Quantum Software: The Qiskit Terra Case Study
arXiv:2512.18088
Abstract
Flaky tests, tests that pass or fail nondeterministically without changes to code or environment, pose a threat to software reliability. While classical software engineering has developed a body of techniques to study flakiness, evidence for quantum software remains limited. Prior work relies on static analysis or small sets of manually reported incidents, leaving open questions about their prevalence, characteristics, and detectability. This paper presents a large-scale dynamic characterization of flaky tests in quantum software through a longitudinal case study of the Qiskit Terra core library. We executed the Qiskit Terra test suite 10,000 times across 23 releases in controlled environments. For each release, we measured test-outcome variability, identified flaky tests, estimated empirical failure probabilities, analyzed recurrence across versions, used Wilson confidence intervals to quantify baseline rerun budgets, and mapped flaky tests to Terra subcomponents. Across 27,026 qualified test identifiers, we identified 62 unique flaky tests. Although flakiness rates were low (0-0.17%), recurrence was substantial: 52 of 62 flaky tests (83.87%) reappeared in multiple releases, while only 10 tests (16.13%) were confined to a single release. Failure probabilities spanned several orders of magnitude, with a median of and 34 tests (54.84%) at or below , implying that thousands to tens of thousands of executions may be required for confident detection. These results show that flakiness observed in the studied Terra releases is rare under our controlled protocol but difficult to detect under typical continuous integration budgets. To support future research and replication, we release a dataset of per-test execution outcomes.
Accepted for publication in the Journal of Systems and Software (JSS). Revised title and clarified the study's scope, experimental protocol, and statistical assumptions. Expanded discussion of root causes, threats to validity, and generalizability