An Intelligent Method for C++ Test Case Synthesis Based on a Q-Learning Agent
Source abstract
Abstract
Ensuring software quality during development requires effective regression testing. However, test suites in open-source libraries often grow large, redundant, and difficult to maintain. Most traditional test suite optimization methods treat test cases as atomic units, without analyzing the utility of individual instructions. This paper presents an intelligent method for test case synthesis using a Q-learning agent. The agent learns to construct compact test cases by interacting with an execution environment and receives rewards based on branch coverage improvements and simultaneous reductions in test case length. The training process includes a pretraining phase that transfers knowledge from the original test suite, followed by adaptive learning episodes on individual test cases. As a result, the method requires no formal documentation or API specifications and uses only execution traces of the original test cases. An explicit synthesis algorithm constructs new test cases by selecting API calls from a learned policy encoded in a Q-table. Experiments were conducted on two open-source C++ libraries of differing API complexity and original test suite size. The results show that the proposed method can reach up to 67% test suite reduction while preserving branch coverage, confirming its effectiveness for regression test suite minimization in resource-constrained or specification-limited environments.
Source: crossref · Quality: baseline
Research context
OpenAlex topics: Software Testing and Debugging Techniques · Software System Performance and Reliability · Software Engineering Research
SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.
Affiliations
Institute of Security and Informatics, University of the National Education Commission, 30-084 Krakow, Poland
Department of “Computer Engineering and Programming”, National Technical University “Kharkiv Polytechnic Institute”, 61000 Kharkiv, Ukraine
References (44)
Show source-provided references
1. Adequate vs. inadequate test suite reduction approaches10.1016/j.infsof.2019.106224 ↗
2. Test Case Selection and Prioritization Using Machine Learning: A Systematic Literature Review10.1007/s10664-021-10066-6 ↗
3. Test Suite Optimization Using Machine Learning Techniques: A Comprehensive Study10.1109/ACCESS.2024.3490453 ↗
4. Regression Testing Minimization, Selection and Prioritization: A Survey10.1002/stv.430 ↗
5. A systematic review on test suite reduction: Approaches, experiment’s quality evaluation, and guidelines
6. Cruciani, E., Miranda, B., Verdecchia, R., and Bertolino, A. (2019, January 25–31). Scalable Approaches for Test Suite Reduction. Proceedings of the 41st International Conference on Software Engineering (ICSE), Montreal, QC, Canada.10.1109/ICSE.2019.00055 ↗
7. Nayab, S., and Wotawa, F. (2024, January 1–5). Testing and reinforcement learning: A structured literature review. Proceedings of the 24th IEEE International Conference on Software Quality, Reliability and Security Companion (QRS-C), Cambridge, UK.10.1109/QRS-C63300.2024.00049 ↗
8. An Empirical Study of Greedy Test Suite Minimization Techniques Using Mutation Coverage10.1109/ACCESS.2023.3289073 ↗
9. Simplifying and Isolating Failure-Inducing Input10.1109/32.988498 ↗
10. HSFal: Effective Fault Localization Using Hybrid Spectrum of Full Slices and Execution Slices10.1016/j.jss.2013.11.1109 ↗
11. Vahabzadeh, A., Stocco, A., and Mesbah, A. (June, January 27). Fine-Grained Test Minimization. Proceedings of the 40th International Conference on Software Engineering (ICSE), Gothenburg, Sweden.
12. Test-Suite Reduction Using Genetic Algorithm
13. Multi-objective Integer Programming Approaches for Solving the Multi-criteria Test-suite Minimization Problem: Towards Sound and Complete Solutions of a Particular Search-based Software-engineering Problem10.1145/3392031 ↗
14. Scalable Similarity-Aware Test Suite Minimization with Reinforcement Learning10.1145/3715008 ↗
15. Tahvili, S., Hatvani, L., Felderer, M., Afzal, W., and Bohlin, M. (2019, January 4–9). Automated Functional Dependency Detection Between Test Cases Using Doc2Vec and Clustering. Proceedings of the 2019 IEEE International Conference on Artificial Intelligence Testing (AITest), Newark, CA, USA.10.1109/AITest.2019.00-13 ↗
16. Waqar, M., Zaman, M., Muzammal, M., and Kim, J. (2022). Test Suite Prioritization Based on Optimization Approach Using Reinforcement Learning. Appl. Sci., 12.10.3390/app12136772 ↗
17. Reinforcement Learning for Test Case Prioritization10.1109/TSE.2021.3070549 ↗
18. Reinforcement Learning-Based Fuzzing Technology
19. Pham, V.-T., Böhme, M., and Roychoudhury, A. (2020, January 24–28). AFLNET: A Greybox Fuzzer for Network Protocols. Proceedings of the 2020 IEEE 13th International Conference on Software Testing, Validation and Verification (ICST), Porto, Portugal.10.1109/ICST46399.2020.00062 ↗
20. Rosenbauer, L., Stein, A., Pätzel, D., and Hähner, J. (2020, January 1–4). XCSF with Experience Replay for Automatic Test Case Prioritization. Proceedings of the 2020 IEEE Symposium Series on Computational Intelligence (SSCI), Canberra, ACT, Australia.10.1109/SSCI47803.2020.9308379 ↗
21. Intelligent Software Debugging: A Reinforcement Learning Approach for Detecting the Shortest Crashing Scenarios10.1016/j.eswa.2022.116722 ↗
22. Sharif, A., Marijan, D., and Liaaen, M. (October, January 27). DeepOrder: Deep Learning for Test Case Prioritization in Continuous Integration Testing. Proceedings of the 2021 IEEE International Conference on Software Maintenance and Evolution (ICSME), Luxembourg.10.1109/ICSME52107.2021.00053 ↗
23. Marijan, D., Gotlieb, A., and Sapkota, A. (2020, January 25–27). Neural Network Classification for Improving Continuous Regression Testing. Proceedings of the 2020 IEEE International Conference on Artificial Intelligence Testing (AITest), Oxford, UK.10.1109/AITEST49225.2020.00025 ↗
24. LSTM-Based Deep Learning for Spatial-Temporal Software Testing10.1007/s10619-020-07291-1 ↗
25. Improving the Prediction of Continuous Integration Build Failures Using Deep Learning10.1007/s10515-021-00319-5 ↗
26. Hybrid Test Case Optimization Approach Using Genetic Algorithm with Adaptive Neuro-Fuzzy Inference System for Regression Testing10.1520/JTE20160137 ↗
27. Test Case Minimization and Prioritization for Regression Testing Using SBLA-Based AdaBoost Convolutional Neural Network10.1007/s11227-022-04540-1 ↗
28. Application of the Law of Minimum and Dissimilarity Analysis to Regression Test Case Prioritization10.1109/ACCESS.2023.3283212 ↗
29. Methodology of Probabilistic Analysis of State Dynamics of Multi-Dimensional Semi-Markov Dynamic Systems
30. Han, D., Mulyana, B., Stankovic, V., and Cheng, S. (2023). A Survey on Deep Reinforcement Learning Algorithms for Robotic Manipulation. Sensors, 23.10.3390/s23073762 ↗
31. Sutton, R.S., and Barto, A.G. (2018). Reinforcement Learning: An Introduction, MIT Press. [2nd ed.].
32. Transfer Learning for Reinforcement Learning Domains: A Survey
33. A Survey on Transfer Learning10.1109/TKDE.2009.191 ↗
34. Ćorović, A., Ilić, V., Ðurić, S., Marijan, M., and Pavković, B. (2018, January 20–21). The Real-Time Detection of Traffic Participants Using YOLO Algorithm. Proceedings of the 2018 26th Telecommunications Forum (TELFOR), Belgrade, Serbia.10.1109/TELFOR.2018.8611986 ↗
35. Reinforcement Learning: A Survey10.1613/jair.301 ↗
36. Human-Level Control through Deep Reinforcement Learning10.1038/nature14236 ↗
37. CIDER: Assisted Automation Tool for C++ Libraries Testing
38. Beazley, D.M. (1996, January 6–10). SWIG: An Easy to Use Tool for Integrating Scripting Languages with C and C++. Proceedings of the 4th Annual Tcl/Tk Workshop, Monterey, CA, USA. Available online: https://www.swig.org/papers/Tcl96/tcl96.html.
39. Matplotlib: A 2D Graphics Environment10.1109/MCSE.2007.55 ↗
40. Semenov, S., Liqiang, Z., and Weiling, C. (2020, January 6–9). Penetration Testing Process Mathematical Model. Proceedings of the 2020 IEEE International Conference on Problems of Infocommunications. Science and Technology (PIC S&T), Kharkiv, Ukraine.10.1109/PICST51311.2020.9468039 ↗
41. Development of a Mathematical Model for the Software Security Testing First Stage
42. Semenov, S., Davydov, V., and Voloshyn, D. (2019, January 7–11). Obfuscated Code Quality Measurement. Proceedings of the 2019 XXIX International Scientific Symposium “Metrology and Metrology Assurance” (MMA), Sozopol, Bulgaria.10.1109/MMA.2019.8936022 ↗
43. Bellemare, M.G., Dabney, W., and Munos, R. (2017, January 6–11). A Distributional Perspective on Reinforcement Learning. Proceedings of the 34th International Conference on Machine Learning (ICML 2017), Sydney, Australia. Available online: https://proceedings.mlr.press/v70/bellemare17a.html.
44. Son, K., Kim, D., Kang, W.J., Hostallero, D.E., and Yi, Y. (2019, January 9–15). QTRAN: Learning to factorize with transformation for cooperative multi-agent reinforcement learning. Proceedings of the 36th International Conference on Machine Learning, Long Beach, CA, USA.