评估大型语言模型结合等价类划分与边界值生成单元测试的能力
Evaluating Large Language Models for the Generation of Unit Tests with Equivalence Partitions and Boundary Values
AI总结:
本文通过融合代码与需求、覆盖等价类和边界值的优化提示,评估 LLM 自动生成单元测试的能力,发现其效果依赖提示、实现与需求质量,仍需人工监督与定性分析。
摘要:
单元测试的设计与实现是一项复杂任务,许多程序员都忽视了它。本研究评估大型语言模型(LLM)自动生成测试用例的潜力,并将其与人工测试进行比较。研究开发了一种优化提示词,将代码与需求整合在一起,覆盖等价类划分和边界值等关键情况。通过定量指标和人工定性分析,比较了 LLM 相对于训练有素程序员的优势与劣势。结果表明,LLM 的有效性取决于设计良好的提示词、稳健的实现以及精确的需求。尽管 LLM 灵活且富有前景,但仍需要人工监督。本工作强调,在单元测试评估中,人工定性分析作为自动化必要补充的重要性。
英文摘要:
The design and implementation of unit tests is a complex task many programmers neglect. This research evaluates the potential of Large Language Models (LLMs) in automatically generating test cases, comparing them with manual tests. An optimized prompt was developed, that integrates code and requirements, covering critical cases such as equivalence partitions and boundary values. The strengths and weaknesses of LLMs versus trained programmers were compared through quantitative metrics and manual qualitative analysis. The results show that the effectiveness of LLMs depends on well-designed prompts, robust implementation, and precise requirements. Although flexible and promising, LLMs still require human supervision. This work highlights the importance of manual qualitative analysis as an essential complement to automation in unit test evaluation.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。