arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.05365cs.SE
收藏

基于大语言模型的缺陷报告测试用例生成:一种认知分层评估框架

Test Case Generation from Bug Reports via Large Language Models: A Cognitive Layered Evaluation Framework

York University(约克大学)

Irtaza Sajid Qureshi, Zhen Ming, Jiang

AI总结:

本文基于布鲁姆认知层次框架,系统评估LLM在缺陷报告测试用例生成中的推理能力,发现标识符变异导致性能大幅下降,而结构化技术元素比叙述性描述更具影响力,并提出了改进方向。

摘要:

大语言模型(LLMs)越来越多地被应用于自动化软件测试,然而它们在超越记忆模式进行泛化以及推理自然语言缺陷报告方面的能力仍不明确。我们提出了一种针对测试用例生成中LLM推理的系统性评估,该评估围绕布鲁姆分类法的认知层次构建:\textit{记忆}、\textit{理解}、\textit{应用}、\textit{分析}、\textit{评估}和\textit{创造},这些层次逐步评估更高水平的认知和推理能力。基于LIBRO框架,我们在Defects4J、GHRB以及引入语言和语义挑战的变异版本上评估了StarCoder和GPT-4o。我们的研究发现,两个模型在很大程度上复现了先前的结果,仅有微小偏差(\textit{记忆});对语言改写和翻译表现出部分鲁棒性,同时发现了独特的可复现缺陷(\textit{理解});但在标识符变异下,性能严重下降,降幅超过60%(\textit{应用})。相反,在开卷设置中提供近乎相同的少样本示例,成功率提高了多达三倍;组件级分析揭示,结构化技术元素(如测试代码和方法名)对成功生成测试用例的影响远大于叙述性描述(\textit{分析})。这些见解阐明了LLM生成测试背后的认知过程,为提升性能提出了具体方向,并为该任务建立了一个稳健且现实的评估范式。

英文摘要:

Large Language Models (LLMs) are increasingly applied to automated software testing, yet their ability to generalize beyond memorized patterns and reason about natural language bug reports remains unclear. We present a systematic evaluation of LLM reasoning in test case generation, structured around the cognitive layers of Bloom's taxonomy: \textit{Remember}, \textit{Understand}, \textit{Apply}, \textit{Analyze}, \textit{Evaluate}, and \textit{Create}, which progressively assess higher levels of cognitive and reasoning capabilities. Building on the LIBRO framework, we evaluate StarCoder and GPT-4o on Defects4J, GHRB, and mutated variants that introduce linguistic and semantic challenges. Our findings show that both models largely reproduce prior results with minor deviations (\textit{Remember}), exhibit partial robustness to linguistic rephrasings and translations while uncovering unique reproducible bugs (\textit{Understand}), but suffer severe performance drops exceeding 60\% under identifier mutations (\textit{Apply}). Conversely, providing near-identical few-shot examples in an open-book setting improves success rates by up to three times, and component-level analysis reveals that structured technical elements, such as test code and method names, are far more impactful than narrative descriptions for successful test generation (\textit{Analyze}). These insights illuminate the cognitive processes underlying LLM-generated tests, suggest concrete directions for improving performance, and establish a robust and realistic evaluation paradigm for this task.

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

↑