Testing is a core activity in software development workflows, and research on its automation has spanned several decades. Most existing approaches generate unit tests for individual methods, validate isolated API endpoints, or target user interface (UI) layers, with non-API and non-UI automated test generators typically exercising only a single focal method. Recent empirical evidence shows a substantial gap between such generated tests and developer-written ones, which often span multiple focal methods, involve complex call sequences, and contain elaborate assertions that current automated approaches fail to capture. To address this gap, we propose generating tests from natural language (NL) descriptions of developer intent. We present Sakura, the first agent-based framework for generating structurally complex test cases from NL descriptions. Sakura decomposes NL descriptions into structured blocks and processes them using a multi-agent system consisting of a localization agent that grounds test steps in concrete application code via static analysis, a composition agent that synthesizes compilable test code and iteratively refines it using execution feedback, and a supervisor agent that coordinates agent interactions. To evaluate Sakura, we curate a novel dataset of NL test descriptions at three levels of abstraction, systematically generated from developer-written tests mined from Apache Commons projects. Across 20 applications and 1,464 test scenarios, Sakura significantly outperforms off-the-shelf agentic tools such as Gemini CLI. Specifically, Sakura achieves 50-78% higher test compilability and 38-66% higher coverage overlap with ground-truth tests compared to baselines using the same models. Moreover, Sakura paired with small open-source models such as Devstral Small 2 and Qwen3-Coder outperforms Gemini CLI using large proprietary models, while also being more cost-effective.


翻译:测试是软件开发流程中的核心活动,对其自动化的研究已跨越数十年。现有大多数方法多为单个方法生成单元测试、验证孤立API端点,或针对用户界面(UI)层进行测试,而非面向API和UI的自动化测试生成器通常只针对单一焦点方法。最新实证证据表明,此类自动生成的测试与开发者编写的测试之间存在显著差距——后者往往跨越多个焦点方法、涉及复杂调用序列并包含精细断言,这些特征难以被当前自动化方法捕捉。为解决这一差距,我们提出从开发者意图的自然语言(NL)描述中生成测试的方法。我们提出Sakura,这是首个基于自然语言描述生成结构复杂测试用例的智能体框架。Sakura将自然语言描述分解为结构化块,并通过多智能体系统进行处理:定位智能体通过静态分析将测试步骤锚定到具体应用代码;组合智能体合成可编译测试代码,并利用执行反馈迭代优化;监督智能体协调智能体间的交互。为评估Sakura,我们构建了一个包含三个抽象层次的自然语言测试描述新数据集,这些描述系统化地源于从Apache Commons项目中挖掘的开发者编写测试。在20个应用及1,464个测试场景中,Sakura显著优于Gemini CLI等现成智能体工具。具体而言,与使用相同模型的基线方法相比,Sakura的测试可编译性提升50-78%,与真实测试的重叠覆盖度提高38-66%。此外,Sakura搭配Devstral Small 2和Qwen3-Coder等小型开源模型时,其性能优于采用大型专有模型的Gemini CLI,同时更具成本效益。

0
下载
关闭预览

相关内容

机器或装置在无人干预的情况下按规定的程序或指令自动进行操作或控制的过程, 是一门涉及学科较多、应用广泛的综合性科学技术。
用于自动驾驶系统测试的生成式人工智能:综述
专知会员服务
17+阅读 · 2025年8月28日
文本、视觉与语音生成的自动化评估方法综述
专知会员服务
20+阅读 · 2025年6月15日
【新书】使用生成式人工智能进行软件测试
专知会员服务
45+阅读 · 2025年1月6日
专知会员服务
19+阅读 · 2021年7月18日
专知会员服务
65+阅读 · 2021年5月29日
自然语言生成资源列表
专知
17+阅读 · 2020年1月4日
基于 rasa 搭建中文对话系统 | 公开课
AI研习社
16+阅读 · 2018年1月12日
从传统方法到深度学习,人脸关键点检测方法综述
机器之心
14+阅读 · 2017年12月17日
TextInfoExp:自然语言处理相关实验(基于sougou数据集)
全球人工智能
12+阅读 · 2017年11月12日
NLP中自动生产文摘(auto text summarization)
机器学习研究会
14+阅读 · 2017年10月10日
Natural 自然语言处理(NLP)「全解析」
人工智能学家
14+阅读 · 2017年9月23日
NLP(自然语言处理)扫盲
大数据和云计算技术
20+阅读 · 2017年7月9日
国家自然科学基金
4+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
最新内容
学习数据的几何:形状空间分析数学综述
专知会员服务
4+阅读 · 6月17日
定向能反无人机系统最新发展动态
专知会员服务
6+阅读 · 6月17日
从燃煤战舰到算法战争:水面指挥的永恒要求
专知会员服务
3+阅读 · 6月17日
相关资讯
自然语言生成资源列表
专知
17+阅读 · 2020年1月4日
基于 rasa 搭建中文对话系统 | 公开课
AI研习社
16+阅读 · 2018年1月12日
从传统方法到深度学习,人脸关键点检测方法综述
机器之心
14+阅读 · 2017年12月17日
TextInfoExp:自然语言处理相关实验(基于sougou数据集)
全球人工智能
12+阅读 · 2017年11月12日
NLP中自动生产文摘(auto text summarization)
机器学习研究会
14+阅读 · 2017年10月10日
Natural 自然语言处理(NLP)「全解析」
人工智能学家
14+阅读 · 2017年9月23日
NLP(自然语言处理)扫盲
大数据和云计算技术
20+阅读 · 2017年7月9日
相关基金
国家自然科学基金
4+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员