On the Feasibility of Quantum Unit Testing
Preprint
Abstract
The increasing complexity of quantum software presents significant challenges for software verification and validation, particularly in the context of unit testing. This work presents a comprehensive study on quantum-centric unit tests, comparing traditional statistical approaches with tests specifically designed for quantum circuits. These include tests that run only on a classical computer, such as the Statevector test, as well as those executable on quantum hardware, such as the Swap test and the novel Inverse test. Through an empirical study and detailed analysis on 1,796,880 mutated quantum circuits, we investigate (a) each test's ability to detect subtle discrepancies between the expected and actual states of a quantum circuit, and (b) the number of measurements required to achieve high reliability. The results demonstrate that quantum-centric tests, particularly the Statevector test and the Inverse test, provide clear advantages in terms of precision and efficiency, reducing both false positives and false negatives compared to statistical tests. This work contributes to the development of more robust and scalable strategies for testing quantum software, supporting the future adoption of fault-tolerant quantum computers and promoting more reliable practices in quantum software engineering.Keywords
All Related Versions
This publication has 50 references indexed in Scilit:
- Quantum circuit mutants: Empirical analysis and recommendationsEmpirical Software Engineering, 2025
- An exploratory study on the usage of quantum programming languagesScience of Computer Programming, 2024
- Bugs4Q: A benchmark of existing bugs to enable controlled testing and debugging studies for quantum programsJournal of Systems and Software, 2023
- A new online testing technique for reversible circuitsIET Quantum Communication, 2022
- Roads towards fault-tolerant universal quantum computationNature, 2017
- Six strategies for generalizing software engineering theoriesScience of Computer Programming, 2015
- Automated Test Oracles2014
- Automated Test Oracles2014
- A Hitchhiker's guide to statistical tests for assessing randomized algorithms in software engineeringSoftware Testing, Verification and Reliability, 2012
- Quantum Computation and Quantum Information2012