arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2511.20403cs.SEcs.AI
收藏

基于大型语言模型的Java自动化单元测试生成与评估:AgoneTest框架

LLMs for Automated Unit Test Generation and Assessment in Java: The AgoneTest Framework

University of Bari, Bari, Italy(巴里大学)

Andrea Lops, Fedelucio Narducci, Azzurra Ragone, Michelantonio Trizio, Claudio Bartolini

AI总结:

AgoneTest框架通过标准化评估流程,评估大型语言模型生成的Java单元测试质量,展示其在覆盖率和缺陷检测上的表现,并探讨提示策略对测试质量的影响。

摘要:

单元测试是软件开发中至关重要的但资源消耗大的步骤,确保每个代码单元正确运行。本文介绍了AgoneTest,一个用于评估大型语言模型生成的Java单元测试的自动化评估框架。AgoneTest不旨在提出新的测试生成算法;而是通过在现实条件下标准化的端到端评估流程,支持研究人员和开发人员比较不同的大型语言模型和提示策略。我们介绍了Classes2Test数据集,该数据集将待测Java类映射到其对应的测试类,并引入了一个集成了高级评估指标,如变异评分和测试异味的框架,以实现全面评估。实验结果表明,对于能够编译的测试子集,LLM生成的测试在覆盖率和缺陷检测方面可以与人工编写测试相媲美。我们的发现还表明,增强的提示策略有助于提高测试质量。AgoneTest阐明了LLM在软件测试中的潜力,并为未来模型设计、提示工程和测试实践的改进提供了见解。

英文摘要:

Unit testing is an essential but resource-intensive step in software development, ensuring individual code units function correctly. This paper introduces AgoneTest, an automated evaluation framework for Large Language Model-generated (LLM) unit tests in Java. AgoneTest does not aim to propose a novel test generation algorithm; rather, it supports researchers and developers in comparing different LLMs and prompting strategies through a standardized end-to-end evaluation pipeline under realistic conditions. We introduce the Classes2Test dataset, which maps Java classes under test to their corresponding test classes, and a framework that integrates advanced evaluation metrics, such as mutation score and test smells, for a comprehensive assessment. Experimental results show that, for the subset of tests that compile, LLM-generated tests can match or exceed human-written tests in terms of coverage and defect detection. Our findings also demonstrate that enhanced prompting strategies contribute to test quality. AgoneTest clarifies the potential of LLMs in software testing and offers insights for future improvements in model design, prompt engineering, and testing practices.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑