一句话:提出 exLong,利用微调 CodeLlama 自动生成异常行为测试,辅助开发者补充异常场景测试。
异常行为测试(EBTs)对于验证代码正确处理意外事件并抛出适当异常至关重要。然而,开发者往往优先测试“快乐路径”,忽视异常场景。本文提出 exLong,一个自动生成 EBTs 的工具。exLong 利用从 CodeLlama 微调的大语言模型(LLM),并融合了对异常抛出轨迹、守卫抛出语句的条件表达式以及执行类似轨迹的非异常行为测试的推理。通过演示视频,论文展示了 exLong 如何有效辅助开发者为其项目创建全面的 EBTs。工具可在线获取。
Exceptional behavior tests (EBTs) are crucial in software development for verifying that code correctly handles unwanted events and throws appropriate exceptions. However, prior research has shown that developers often prioritize testing "happy paths", i.e., paths without unwanted events, over exceptional scenarios. We present exLong, a tool that automatically generates EBTs to address this gap. exLong leverages a large language model (LLM) fine-tuned from CodeLlama and incorporates reasoning about exception-throwing traces, conditional expressions that guard throw statements, and non-exceptional behavior tests that execute similar traces. Our demonstration video illustrates how exLong can effectively assist developers in creating comprehensive EBTs for their project (available at https://youtu.be/Jro8kMgplZk).
@inproceedings{paperbot8989,
title = {A Tool for Generating Exceptional Behavior Tests With Large Language Models},
author = {Linghan Zhong and Samuel Yuan and Jiyang Zhang and Yu Liu and Pengyu Nie and Junyi Jessy Li and Milos Gligoric},
booktitle = {FSE},
year = {2025},
doi = {10.1145/3696630.3728608}
}