一句话:首次大规模研究LLM生成测试预言,提出TOGLL,在正确性、多样性和缺陷检测上显著优于TOGA与EvoSuite。
测试预言对缺陷检测至关重要,但已有神经方法常误报多、预言强度弱;LLM在测试预言生成上缺乏大规模研究。本文在110个Java项目上,以六种提示微调七个代码LLM,选出最佳组合并提出TOGLL。作者在25个未见Java项目上评估泛化性,与EvoSuite和SOTA方法TOGA比较正确性、多样性和强度。结果显示,TOGLL生成的正确断言预言为TOGA的3.8倍、异常预言为4.9倍;检测到1,023个EvoSuite无法检测的唯一变异体,约为TOGA的十倍,并在Defects4J真实缺陷检测上显著优于TOGA。
Test oracles play a crucial role in software testing, enabling effective bug detection. Despite initial promise, neural methods for automated test oracle generation often result in a large number of false positives and weaker test oracles. While LLMs have shown impressive effectiveness in various software engineering tasks, including code generation, test case creation, and bug fixing, there remains a notable absence of large-scale studies exploring their effectiveness in test oracle generation. The question of whether LLMs can address the challenges in effective oracle generation is both compelling and requires thorough investigation. In this research, we present the first comprehensive study to investigate the capabilities of LLMs in generating correct, diverse, and strong test oracles capable of effectively identifying a large number of unique bugs. To this end, we fine-tuned seven code LLMs using six distinct prompts on a large dataset consisting of 110 Java projects. Utilizing the most effective finetuned LLM and prompt pair, we introduce TOGLL, a novel LLM-based method for test oracle generation. To investigate the generalizability of TOGLL, we conduct studies on 25 unseen large-scale Java projects. Besides assessing the correctness, we also assess the diversity and strength of the generated oracles. We compare the results against EvoSuite and the state-of-the-art neural method, TOGA. Our findings reveal that TOGLL can produce 3.8 times more correct assertion oracles and 4.9 times more exception oracles than TOGA. Regarding bug detection effectiveness, TOGLL can detect 1,023 unique mutants that EvoSuite cannot, which is ten times more than what TOGA can detect. Additionally, TOGLL significantly outperforms TOGA in detecting real bugs from the Defects4J dataset.
DOI 原文 ·
@inproceedings{paperbot8802,
title = {TOGLL: Correct and Strong Test Oracle Generation with LLMS},
author = {Soneya Binta Hossain and Matthew B. Dwyer},
booktitle = {ICSE},
year = {2025},
doi = {10.1109/icse55347.2025.00098}
}