Research Article

A Survey and Prospects on Unit Test Case Generation Techniques Based on Large Language Models

Zhuoying Yang1,2, Lei Wang1,3,*
1. College of Mathematics and Computer Science, Yan'an University, Yan'an, Shaanxi 716000, China
2. Key Laboratory of Industrial Internet and Big Data,China National Light Industry, Beijing 100081
3. School of Computer Science & Technology, Beijing Institute of Technology, Beijing 100081, China

* Corresponding author: [email protected]

Abstract

Automated unit test case generation is a critical research topic in the field of software engineering. Numerous scholars at home and abroad have devoted considerable efforts to addressing this problem and have achieved fruitful results. In recent years, the emergence of large language models (LLMs), such as the GPT series, LLaMA series, DeepSeek series, T5, and their variants tailored for source code, has introduced new technical pathways for unit test case generation, thereby reigniting widespread scholarly interest in this area. To further promote the theoretical and practical development of LLM-based unit test case generation, this study presents a comprehensive survey and an outlook on future research. It reviews and analyzes the evolution of unit test case generation techniques, from early exploratory efforts to the current stage driven by large models. Starting from two main categories—techniques that rely solely on LLMs and those that integrate traditional static analysis—the current state of research and recent advancements in LLM-based test generation are discussed. On this basis, the study summarizes the major issues and challenges in the field and envisions possible future research directions. This work systematically presents the developmental trajectory, latest progress, and future prospects of this domain, offering valuable insights and guidance for subsequent research and innovation.

Keywords: Software Engineering; Unit Test Case Generation; Literature Review; Large Language Models; Prompt Learning
Published: August 25, 2025
DOI: 10.54254/2755-2721/2025.26220
Volume: ACE Vol.170
pp. 27-35
Download PDF

References

  1. Myers, G.J., Sandler, C., and Badgett, T. (2011) The Art of Software Testing. John Wiley & Sons, Hoboken.
  2. Bozga, M., Fernandez, J.C., and Ghirvu, L. (2000) Using static analysis to improve automatic test generation. In: International Conference on Tools and Algorithms for the Construction and Analysis of Systems, pp. 235–250. Springer, Berlin, Heidelberg.
  3. Babić, D., Martignoni, L., McCamant, S., et al. (2011) Statically-directed dynamic automated test generation. In: Proceedings of the 2011 International Symposium on Software Testing and Analysis, pp. 12–22. ACM, New York, NY.
  4. Kallingal Joshy, A., Chen, X., Steenhoek, B., et al. (2021) Validating static warnings via testing code fragments. In: Proceedings of the 30th ACM SIGSOFT International Symposium on Software Testing and Analysis, pp. 540–552. ACM, New York, NY.
  5. Godefroid, P. (2012) Test generation using symbolic execution. In: IARCS Annual Conference on Foundations of Software Technology and Theoretical Computer Science (FSTTCS 2012), pp. 24–33. Schloss Dagstuhl–Leibniz-Zentrum für Informatik, Wadern.
  6. Uehara, T. (2016) Exhaustive Test-case Generation using Symbolic Execution. FUJITSU Sci. Tech. J., 52(1), 34–40.
  7. Staats, M. and Pǎsǎreanu, C. (2010) Parallel symbolic execution for structural test generation. In: Proceedings of the 19th International Symposium on Software Testing and Analysis, pp. 183–194. ACM, New York, NY.
  8. Ma, E., Fu, X., and Wang, X. (2022) Scalable path search for automated test case generation. Electronics, 11(5), 727.
  9. Maragathavalli, P. (2011) Search-based software test data generation using evolutionary computation. arXiv preprint arXiv: 1103.0125.
  10. Suresh, Y. and Rath, S.K. (2014) A genetic algorithm based approach for test data generation in basis path testing. arXiv preprint arXiv: 1401.5165.
  11. Smith, G.D., Steele, N.C., Albrecht, R.F., et al. (1998) Genetic algorithm based software testing. In: Artificial Neural Nets and Genetic Algorithms: Proceedings of the International Conference in Norwich, UK, pp. 325–328. Springer, Vienna.
  12. Tufano, M., Drain, D., Svyatkovskiy, A., et al. (2022) Generating accurate assert statements for unit test cases using pretrained transformers. In: Proceedings of the 3rd ACM/IEEE International Conference on Automation of Software Test, pp. 54–64. ACM, New York, NY.
  13. Alagarsamy, S., Tantithamthavorn, C., and Aleti, A. (2024) A3test: Assertion-augmented automated test case generation. Information and Software Technology, 176, 107565.
  14. Dinella, E., Ryan, G., Mytkowicz, T., et al. (2022) Toga: A neural method for test oracle generation. In: Proceedings of the 44th International Conference on Software Engineering, pp. 2130–2141. ACM, New York, NY.
  15. Husakovskyi, A. (2025) Harnessing Graph Neural Networks (GNN) for automated test case prioritization: Challenges and opportunities in QA automation. The American Journal of Engineering and Technology, 7(04), 07–15.
  16. Samoaa, H.P., Longa, A., Mohamad, M., et al. (2022) Tep-GNN: Accurate execution time prediction of functional tests using graph neural networks. In: International Conference on Product-Focused Software Process Improvement, pp. 464–479. Springer, Cham.
  17. Yuan, Z., Lou, Y., Liu, M., et al. (2023) No more manual tests? Evaluating and improving ChatGPT for unit test generation. arXiv preprint arXiv: 2305.04207.
  18. Schäfer, M., Nadi, S., Eghbali, A., et al. (2023) An empirical evaluation of using large language models for automated unit test generation. IEEE Transactions on Software Engineering, 50(1), 85–105.
  19. Chen, Y., Hu, Z., Zhi, C., et al. (2024) ChatUniTest: A framework for LLM-based test generation. In: Companion Proceedings of the 32nd ACM International Conference on the Foundations of Software Engineering, pp. 572–576. ACM, New York, NY.
  20. Wang, Z., Liu, K., Li, G., et al. (2024) HITS: High-coverage LLM-based unit test generation via method slicing. In: Proceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering, pp. 1258–1268. ACM, New York, NY.
  21. Alagarsamy, S., Tantithamthavorn, C., Takerngsaksiri, W., et al. (2024) Enhancing large language models for text-to-testcase generation. arXiv preprint arXiv: 2402.11910.
  22. Wang, J., Suleiman, B., and Alibasa, M.J. (2025) Automated unit test case generation: A systematic literature review. arXiv preprint arXiv: 2504.20357.
  23. Fontes, A. and Gay, G. (2023) The integration of machine learning into automated test generation: A systematic mapping study. Software Testing, Verification and Reliability, 33(4), e1845.
  24. Ali, S., Briand, L.C., Hemmati, H., et al. (2009) A systematic review of the application and empirical investigation of search-based test case generation. IEEE Transactions on Software Engineering, 36(6), 742–762.
  25. McMinn, P. (2004) Search-based software test data generation: A survey. Software Testing, Verification and Reliability, 14(2), 105–156.
  26. Pecorelli, F., Grano, G., Palomba, F., et al. (2024) Toward granular search-based automatic unit test case generation. Empirical Software Engineering, 29(4), 71.
  27. Qi, F., Hou, Y., Lin, N., et al. (2024) A survey of testing techniques based on large language models. In: Proceedings of the 2024 International Conference on Computer and Multimedia Technology, pp. 280–284. ACM, New York, NY.
  28. Alenezi, M. and Zarour, M. (2020) On the relationship between software complexity and security. arXiv preprint arXiv: 2002.07135.
  29. Ahamed, S.S. (2010) Studying the feasibility and importance of software testing: An analysis. arXiv preprint arXiv: 1001.4193.
  30. Khorikov, V. (2020) Unit Testing Principles, Practices, and Patterns. Manning Publications, New York, NY.
  31. Fraser, G. and Arcuri, A. (2011) EvoSuite: Automatic test suite generation for object-oriented software. In: Proceedings of the 19th ACM SIGSOFT Symposium and the 13th European Conference on Foundations of Software Engineering, pp. 416–419. ACM, New York, NY.
  32. Pacheco, C., Lahiri, S.K., Ernst, M.D., et al. (2007) Feedback-directed random test generation. In: 29th International Conference on Software Engineering (ICSE'07), pp. 75–84. ACM, New York, NY.
  33. Pacheco, C. and Ernst, M.D. (2007) Randoop: Feedback-directed random testing for Java. In: Companion to the 22nd ACM SIGPLAN Conference on Object-Oriented Programming Systems and Applications Companion, pp. 815–816. ACM, New York, NY.
  34. Randoop Project (2025) Randoop: Automatic unit test generation for Java. https: //randoop.github.io/randoop/, last accessed 2025/06/02.
  35. Cadar, C., Dunbar, D., and Engler, D.R. (2008) Klee: Unassisted and automatic generation of high-coverage tests for complex systems programs. In: OSDI 2008, pp. 209–224.
  36. Radford, A., Narasimhan, K., Salimans, T., et al. (2018) Improving language understanding by generative pre-training.
  37. Feng, Z., Guo, D., Tang, D., et al. (2020) CodeBERT: A pre-trained model for programming and natural languages. arXiv preprint arXiv: 2002.08155.
  38. Touvron, H., Lavril, T., Izacard, G., et al. (2023) LLaMA: Open and efficient foundation language models. arXiv preprint arXiv: 2302.13971.
  39. Bi, X., Chen, D., Chen, G., et al. (2024) DeepSeek LLM: Scaling open-source language models with longtermism. arXiv preprint arXiv: 2401.02954.
  40. Wang, L., Yuan, Y., and Wang, G.R. (2025) Design pattern detection techniques in software: Current status, challenges, and prospects. Journal of Software, 36(6), 2643–2682 (in Chinese).
  41. Jiang, J., Wang, F., Shen, J., et al. (2024) A survey on large language models for code generation. arXiv preprint arXiv: 2406.00515.
  42. Yang, Z.Y. and Wang, L. IntelliUnitGen: A unit test case generation framework based on the integration of static analysis and prompt learning. IEEE Access (Online).
  43. Zhang, Q., Fang, C., Xie, Y., et al. (2024) A systematic literature review on large language models for automated program repair. arXiv preprint arXiv: 2405.01466.
  44. Apache Software Foundation (2024) Apache Commons CLI. https: //github.com/apache/commons-cli, last accessed 2024/05/12.
  45. Wei, J., Wang, X., Schuurmans, D., et al. (2022) Chain-of-thought prompting elicits reasoning in large language models. Advances in Neural Information Processing Systems, 35, 24824–24837.
  46. Liu, C., Zhang, S.D., Ibrahimzada, A.R., et al. (2024) CodeMind: A framework to challenge large language models for code reasoning. arXiv preprint arXiv: 2402.09664.