Reproduce “Grounding AI Agents in Contracts: An Empirical Evaluation of Spec-Driven Test Generation” on OpenResearch
Run Claude Code, Codex or any coding agent as a research agent: literature, hypotheses and experiments on your laptop, cluster or cloud GPUs.
Universal app for Apple silicon and Intel. Requires macOS 11 or later.
About this paper
Michele Tufano, James McClure, José Cambronero, Runxiang Cheng, Sherry Y. Shi, Renyao Wei, Dorothy Chen, Franjo Ivančić and 2 more
Google researchers developed a two-phase agentic framework called "Spec-Driven Test Generation," where an AI agent first generates behavioral contracts and then utilizes them to guide test creation. This methodology improved historical bug detection by 9.8 percentage points at k=5 and enhanced branch coverage by 2.5 percentage points compared to a direct test generation baseline.
Key insights
- Explicitly grounding LLM-based test generation in self-generated semi-formal behavioral contracts acts as an effective "cognitive scaffold," leading to a more systematic exploration of the program's state space.
- Agent-generated specifications can accurately capture violated behavioral contracts, and there is a statistically significant correlation between contract coverage and subsequent bug detection effectiveness.
- The two-phase approach allows LLM agents to produce test suites that are qualitatively superior to direct generation methods and competitive with human-authored tests in terms of rigor, edge-case coverage, and adherence to best practices.
Summary by alphaXiv.
Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.