LLM在软件测试用例智能生成中的应用研究
Research on the Application of LLM in Intelligent Generation of Software Test Cases
摘要: 为了改变传统软件测试用例设计工作中对测试人员个人经验和能力的强依赖,进一步提高测试用例设计的自动化和智能化水平,本文研究提出一种基于大语言模型(Large Language Model, LLM)的软件测试用例智能生成方案,主要包括专业领域测试用例向量知识库构建、检索增强生成、提示词工程、基于人机交互的总结反思优化,增强了大模型的测试用例生成能力,提高了测试用例设计的工作效率和质量。实验结果表明,本文提出的方法能够明显提升大模型生成测试用例的质量和缩短测试用例设计周期,可进一步推广到工程实际中应用。
Abstract: In order to overcome the strong reliance on individual experience and ability of testers in traditional software test case design work, and to further enhance the automation and intelligence level of test case design, this paper proposes an intelligent software test case generation scheme based on a large language model (LLM). It primarily includes the construction of a vector knowledge base for test cases in professional fields, retrieval-augmented generation, prompt engineering, and summary and reflection optimization based on human-computer interaction. This approach enhances the test case generation capabilities of the LLM and improves the efficiency and quality of test case design. The experimental results demonstrate that the method proposed in this paper can significantly enhance the quality of test cases generated by LLM and shorten the test cases design cycle, which can be further promoted for application in engineering practice.
文章引用:赵东升, 孟伟, 徐锋, 于铁军. LLM在软件测试用例智能生成中的应用研究[J]. 计算机科学与应用, 2025, 15(12): 222-227. https://doi.org/10.12677/csa.2025.1512337

参考文献

[1] 张清睿, 黄松, 孙乐乐. Web功能自动化测试综述[J]. 软件导刊, 2023, 22(3): 227-236.
[2] Chen, Y.H., Hu, Z.H., Zhi, C., et al. (2023) ChatUniTest: A Framework for LLM-Based Test Generation. arXiv: 2305.04764.
[3] Tang, Y., Liu, Z., Zhou, Z. and Luo, X. (2024) ChatGPT vs SBST: A Comparative Assessment of Unit Test Suite Generation. IEEE Transactions on Software Engineering, 50, 1340-1359. [Google Scholar] [CrossRef
[4] Yang, L., Yang, C., Gao, S., Wang, W., Wang, B., Zhu, Q., et al. (2024) On the Evaluation of Large Language Models in Unit Test Generation. Proceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering, Sacramento, 27 October-1 November 2024, 1607-1619. [Google Scholar] [CrossRef
[5] Roy Chowdhury, S., Sridhara, G., Raghavan, A.K., Bose, J., Mazumdar, S., Singh, H., et al. (2024) Static Program Analysis Guided LLM Based Unit Test Generation. Proceedings of the 8th International Conference on Data Science and Management of Data (12th ACM IKDD CODS and 30th COMAD), Jodhpur, 18-21 December 2024, 279-283. [Google Scholar] [CrossRef
[6] 杨浠, 熊盼, 郑旭飞, 等. AIGC辅助软件单元测试的研究[J]. 人工智能科学与工程, 2024(4): 31-41.
[7] 王赞, 王莹, 陈碧欢, 姚远, 张敏灵. 大模型下的软件质量保障专题前言[J]. 软件学报, 2025, 36(6): 2401-2403.