华东师范大学学报(自然科学版) ›› 2026, Vol. 2026 ›› Issue (4): 143-153.doi: 10.3969/j.issn.1000-5641.2026.04.015

• • 上一篇    

基于大语言模型的测试用例图谱生成研究

宫泽正(), 沈富可, 魏同权*()   

  1. 华东师范大学 计算机科学与技术学院, 上海 200062
  • 收稿日期:2025-01-15 出版日期:2026-07-25 发布日期:2026-07-18
  • 通讯作者: 魏同权 E-mail:51255901046@stu.ecnu.edu.cn;tqwei@cs.ecnu.edu.cn
  • 基金资助:
    国家自然科学基金面上项目(62272169)

Automatic generation of use case diagrams from product requirement documents using large language models

Zezheng GONG(), Fuke SHEN, Tongquan WEI*()   

  1. School of Computer Science and Technology, East China Normal University, Shanghai 200062, China
  • Received:2025-01-15 Online:2026-07-25 Published:2026-07-18
  • Contact: Tongquan WEI E-mail:51255901046@stu.ecnu.edu.cn;tqwei@cs.ecnu.edu.cn

摘要:

随着互联网和移动应用行业的迅速发展, 敏捷开发已成为众多公司在产品迭代过程中首选的开发方法. 然而, 产品需求文档复杂性增加, 导致测试流程复杂度不断增长, 降低了整体流程效率. 针对以上问题, 开展基于大语言模型与产品需求文档的测试用例图谱生成研究. 通过提示词工程技术, 优化基于大模型的产品需求文档到测试用例图谱的转换过程, 确保系统准确理解和提取产品需求文档中的关键信息, 生成测试人员能够直接应用的测试用例图谱, 保证用户易用性. 同时, 基于实际业务场景, 创建一套完善的评估体系, 系统化衡量测试用例图谱生成质量. 最终结合实验进一步优化输出格式与提示词, 实验结果表明, 应用优化策略后平均提升32%的用户采纳率, 整体节省测试人员30%用例编写时间.

关键词: 大语言模型, 产品需求文档, 提示词工程, 自动化测试, 测试用例生成

Abstract:

With the rapid growth of the internet and mobile application industries, agile development has become the preferred approach for product iteration in many organizations. However, as product requirement documents become increasingly complex, the testing process also becomes more complicated, reducing overall development efficiency. To address this challenge, this study investigates the automatic generation of use case diagrams from product requirement documents using large language models. Prompt engineering techniques are employed to optimize the conversion process, enabling the model to accurately understand and extract key information from requirement documents and directly generate use case diagrams that can be readily used by testers. In addition, a comprehensive evaluation framework is developed based on real business scenarios to systematically assess the quality of the generated diagrams. The output format and prompts are further refined through iterative experiments. Experimental results show that the proposed optimization strategy increases the average user adoption rate by 32% and reduces the time required for testers to create test cases by 30%.

Key words: large language models, product requirement documents, prompt engineering, automated testing, test case generation

中图分类号: