---
格式版本: 2
标题: "Grounding AI Agents in Contracts: An Empirical Evaluation of Spec-Driven Test Generation"
原文链接: "https://arxiv.org/abs/2608.17177"
发布日期: "2026-08-17"
发布时间校准状态: "found"
发布时间需复核: "否"
发布时间来源: "rule:local:strict_original_body"
发布时间证据: "**\\[v1\\]** Mon, 17 Aug 2026 22:36:12 UTC (179 KB)"
发布时间校准原因: "规则确认唯一严格发布时间，来源 local:strict_original_body"
发布时间校准置信度: "high"
发布时间候选数量: 18
发布时间严格候选数量: 6
发布时间原页读取状态: "source template page reused from URL open"
发布时间未找到原因: ""
发布时间校准时间: "2026-08-20T14:40:29+08:00"
发布时间仲裁状态: "skipped"
发布时间仲裁尝试次数: 0
发布时间仲裁耗时毫秒: 0
发现时间: "2026-08-20T14:38:39+08:00"
入库时间: "2026-08-20T06:40:30.011Z"
来源平台: "arXiv 学术论文搜索"
搜索渠道: "source_template"
搜索词: "https://arxiv.org/search/?query=Google&searchtype=all"
匹配关键词:
  - "AI"
相关厂家:
  - "Google"
相关专家:
  []
内容类型: "网页"
抓取工具: "Free Fetch + Defuddle"
清洗工具: "Defuddle Markdown + Defuddle/Readability 正文提取"
原始附件:
  []
AI优质: "否"
AI打分: 10
AI分档: "非优质"
AI质检状态: "不通过"
AI打分理由: "该论文主题为AI代理的规格驱动测试生成，属于软件工程领域，与超节点、AI Rack、机柜级AI基础设施等完全无关，无任何相关技术或商业信号。"
AI质检模型: "tx-deepseek-v4-flash"
AI质检时间: "2026-08-20T14:41:33+08:00"
AI主题相关性: 0
AI来源权威性: 5
AI新颖性: 0
AI技术细节: 0
AI商业部署信号: 0
AI完整性: 5
AI摘要: "提出了一种“规范驱动测试生成”方法，让LLM代理先生成前置条件、后置条件和未定义行为等半形式化规范，再据此生成测试。"
AI摘要模型: "ali-deepseek-v4-flash"
AI摘要时间: "2026-09-07T03:25:01.026Z"
采集批次: "2026年8月20日14点19分32秒"
采集批次ID: "20260820-141932-079"
去重键: "https://arxiv.org/abs/2608.17177"
---

## Computer Science > Software Engineering

## Title:Grounding AI Agents in Contracts: An Empirical Evaluation of Spec-Driven Test Generation

[View PDF](https://arxiv.org/pdf/2608.17177) [HTML (experimental)](https://arxiv.org/html/2608.17177v1)

> Abstract:LLM-based agents are increasingly used for coding tasks, where they have outperformed many classical approaches and scaled to repository-level tasks, such as test generation. However, when directly prompted to generate tests, these agents can fail to reason about the code and its underlying contracts, thereby missing edge cases and behavioral boundaries that affect test quality. To address this limitation, we propose Spec-Driven Test Generation, where we instruct an agent to first reason about -- and explicitly document -- code pre-conditions, post-conditions, and undefined behaviors. This intermediate semi-formal specification acts as a cognitive scaffold to guide subsequent test generation. Our evaluation on production bugs from Google shows that the spec-driven agent can deliver a 9.8 percentage points ($p = 0.0352$) improvement in bug detection rate and a 2.5 percentage point ($p = 0.0034$) improvement in branch coverage, compared to a traditional test generation agent baseline. Using LLM-as-a-Judge, we further show that test suites generated by the spec-driven agent are superior to the baseline and human-authored tests in 77.8% and 56.7% of the cases, respectively, and demonstrated improvements on following best practices, readability, and edge-case coverage.

| Subjects: | Software Engineering (cs.SE) |
| --- | --- |
| Cite as: | [arXiv:2608.17177](https://arxiv.org/abs/2608.17177) \[cs.SE\] |
|  | (or [arXiv:2608.17177v1](https://arxiv.org/abs/2608.17177v1) \[cs.SE\] for this version) |
|  | [https://doi.org/10.48550/arXiv.2608.17177](https://doi.org/10.48550/arXiv.2608.17177) |

## Submission history

From: Michele Tufano \[[view email](https://arxiv.org/show-email/925001f8/2608.17177)\]  
**\[v1\]** Mon, 17 Aug 2026 22:36:12 UTC (179 KB)

[Which authors of this paper are endorsers?](https://arxiv.org/auth/show-endorsers/2608.17177) | Disable MathJax ([What is MathJax?](https://info.arxiv.org/help/mathjax.html))
