arXiv:2610.36584cs.SEOct 2026

Manuscript Offprint

arXiv:2610.36584

Benchmarking LLM Agents for Behaviorally Adequate Test Generation from Software Requirements

Binhang Qi, Yiming Liu, Yun Lin, Yangjie Zhou, Hailong Sun, Jin Song Dong

BINHANG QI, National University of Singapore, Singapore

YIMING LIU, Shanghai Jiao Tong University, China and Shanghai Innovation Institute, China

YUN LIN ∗^{*}, Shanghai Jiao Tong University, China

YANGJIE ZHOU, National University of Singapore, Singapore

HAILONG SUN, Beihang University, China

JIN SONG DONG, National University of Singapore, Singapore

As large language model (LLM) agents increasingly compile natural-language requirements into repository-level code, requirement-to-test generation grows in importance to provide validation constraints (or harness) to guide code generation. Yet it remains unclear whether current agents can generate tests that validate the required behavior when the implementation of that behavior is withheld. Existing test-generation benchmarks mostly focus on white-box testing, whereas the requirement-test-related study usually requires evaluation on semantic alignment between the given documents and the generated tests.

We introduce REQ2TEST-BENCH, a benchmark containing 5,086 execution-validated instances recovered from developer-authored behavior-driven development (BDD) artifacts in 8 open-source projects, spanning 5 programming languages and 4 BDD frameworks. Each instance pairs a natural-language requirement in Gherkin with its developer-written Test Implementation. Given the requirement, target interfaces of the required behavior, and a repository view that withholds either the target implementation or all production implementations, an agent must generate a complete, potentially multi-file Test Implementation. Solving the task requires bridging the gap between a high-level requirement and its test-code correspondence regarding project-specific knowledge: crystallizing what to test, stated in natural language, into how to test it with the project's own fixtures, helpers, and interfaces. We evaluate the semantic difference between generated and ground-truth tests by comparing their production API calls, code coverage, and mutant kills. Evaluation of 8 agent-model-reasoning configurations reveals a substantial gap between execution success and behavioral adequacy, which is measured strictly as kill-completeness: a kill-complete test kills every mutant that the ground-truth test kills. The best-performing configuration, Codex with DeepSeek-V4.1-Flash, produces passing tests for 82.8% of instances, yet only 33.8% are behaviorally adequate. We find that (1) scaling up agents yields sharply diminishing returns in behavioral adequacy relative to generation cost; (2) under-specified requirements cause the information gap, including ambiguous setup and implicit expected outcomes; and (3) requirement-grounded harnesses that steer agent non-determinism offer a promising direction for improvement.

1 Introduction

Large language model (LLM) agents increasingly translate natural-language software requirements into repository-wide implementations [38]. As code generation accelerates, validation becomes a bottleneck: developers need executable evidence that generated software satisfies the requested behavior rather than merely compiling or appearing plausible. Requirement-derived tests provide behavioral checks for code-generation harnesses, supporting candidate selection and iterative refinement [6, 16]. Yet a generated test may pass while omitting meaningful checks or relying on tautological assertions [18, 33]. The challenge is sharper when tests must be written before an implementation of the required behavior is available [23]. We thus ask: can current LLM agents

∗^{*}Corresponding Author.

Authors' Contact Information: Binhang Qi, qibh@nus.edu.sg, National University of Singapore, Singapore; Yiming Liu, liu_yiming@sjtu.edu.cn, Shanghai Jiao Tong University, China and Shanghai Innovation Institute, China; Yun Lin, lin_yun@sjtu.edu.cn, Shanghai Jiao Tong University, China; Yangjie Zhou, yj_zhou@nus.edu.sg, National University of Singapore, Singapore; Hailong Sun, sunhl@buaa.edu.cn, Beihang University, China; Jin Song Dong, dcsdjs@nus.edu.sg, National University of Singapore, Singapore.

Binhang Qi, Yiming Liu, Yun Lin, Yangjie Zhou, Hailong Sun, and Jin Song Dong

Figure

Fig. 1. Overview of the REQ2TEST-BENCH task. Each instance provides a requirement composed of enclosing Feature context and a target Scenario, together with designated target interfaces and project context exposed through either a target-hidden or an all-hidden view. Both views withhold the target implementation. Target-hidden retains other permitted production implementations, whereas all-hidden withholds them. An LLM agent generates a complete, potentially multi-file Test Implementation. After generation, an evaluator runs the test against the complete production implementation, recording staged functional outcomes and comparing its production-API calls, code coverage, and mutant kills with those of the ground-truth Test Implementation.

generate complete, executable, and behaviorally adequate tests from software requirements when the target implementation is withheld? We examine it through three questions:

• Q1: Does scaling up LLM agents reliably and proportionally improve behavioral adequacy?

• Q2: If not, what gaps limit the progress?

• Q3: What directions are promising to narrow the gap, guiding the development of LLM agents? In this work, we define the requirement and the behavioral adequacy as follows:

DEFINITION 1. (Requirement) A requirement is a natural-language statement of one software behavior expected from a software system, stated independently of the code that realizes it. It is concrete enough to determine a testing objective, typically by stating the relevant conditions, the triggering interaction, and the expected observable outcome.

DEFINITION 2 (Behavioral Adequacy). A test is behaviorally adequate for a requirement if it exercises the behavior prescribed by that requirement and correctly checks the expected outcomes in the project's context.

Existing LLM-based test-generation studies and benchmarks start from prescribed methods, classes, or source files [18, 36, 41], from code changes [15], from issue reports [1, 26], or from behavior inferred by exploring a running application [3]. Consequently, their results alone do not suffice to answer these questions.

We instead study requirement-to-test generation, which is requirement-driven: an independently stated requirement determines the testing objective, and the target implementation is withheld from the agent. Related requirement–test resources address parts of this problem; however, they have complementary limitations: ① Some synthesize or manually adapt requirement or test artifacts during benchmark construction [24, 25]; ② others associate a coarse requirement artifact, such as a project-level requirement, with an entire test file rather than with the complete Test Implementation for one individual, concrete behavior [21, 24].

To address these limitations, REQ2TEST-BENCH combines authentic requirements, complete ground-truth Test Implementations for individual behaviors, execution-validated mappings, and behavioral evaluation under controlled implementation visibility. We instantiate the task using artifacts from behavior-driven-development (BDD) repositories. BDD projects express requirements in Gherkin, where a Feature describes a capability and groups related Scenarios, while a Scenario expresses a concrete behavioral example through an ordered sequence of Steps [35], as shown in Figure 1. Their availability across open-source projects and programming languages, without restriction to a particular test level, supports large-scale and diverse benchmark construction [21].

Accordingly, for each REQ2TEST-BENCH instance, we operationally define one requirement rir_i as the pair of an enclosing Feature FiF_i and a target Scenario SiS_i. We formalize the requirement-to-test generation task as:

Tigen=A(ri,Iiα),ri≜⟨Fi,Si⟩,Iiα≜⟨Iitar,Cα(Pi)⟩.(1)T_{i}^{g e n}=\mathcal{A}\big(r_{i},\mathcal{I}_{i}^{\alpha}\big),\qquad r_{i}\triangleq\langle F_{i},S_{i}\rangle,\qquad\mathcal{I}_{i}^{\alpha}\triangleq\big\langle\mathcal{I}_{i}^{\mathrm{t a r}},C_{\alpha}(P_{i})\big\rangle. \tag{1}

The agent-visible project information IiαI_i^\alpha combines the designated target interfaces IitarI_i^{\text{tar}} with available project context Cα(Pi)C_\alpha(P_i). IitarI_i^{\text{tar}} provides method declarations derived from first-party public production calls made directly by the ground-truth test's action and check Steps. They provide interface-localization cues, but do not enumerate the auxiliary APIs, fixtures, or helpers needed to construct the test. Cα(Pi)C_\alpha(P_i) of project snapshot PiP_i is exposed through one of two views, with α∈{TH,AH}\alpha \in \{TH, AH\}: ① In the target-hidden view CTH(Pi)C_{\text{TH}}(P_i), the selected production bodies realizing the target behavior, including relevant first-party delegation, are replaced with declaration-preserving placeholders. ② In the all-hidden view CAH(Pi)C_{\text{AH}}(P_i), implementation bodies throughout the project's declared production-code scope are likewise replaced. The output TigenT_i^{gen} generated by an LLM agent A\mathcal{A} is one complete, potentially multi-file Test Implementation containing the test-side artifacts needed to build, bind, execute, and check SiS_i. After generation, TigenT_i^{gen} from either view is evaluated by executing it against the same complete production implementation in a separate environment. As illustrated by Figure 1, rir_i pairs the Feature “Adding a new Currency ...” with the Scenario “Site should be using currency ‘USD’ ...”. IitarI_i^{\text{tar}} includes StoreContextInterface::getStore() and CurrencyInterface::getId(), and TigenT_i^{gen} spans three PHP files.

To construct REQ2TEST-BENCH, we recover the developer-written Test Implementation of each Scenario from the Step Definitions that the native BDD framework binds to its Steps at runtime, validate each recovered mapping by execution, and freeze a per-instance mutant pool with the kills of the ground-truth test. REQ2TEST-BENCH's validated mapping dataset contains 5,086 Requirement-Test Implementation instances from 1,415 Features in 8 projects, spanning 5 languages, 6 domains, 4 BDD frameworks, and component-, integration-, and system-level tests.

We evaluate 8 agent-model-reasoning configurations that vary the coding agent (Aider, OpenHands, Claude Code, and Codex CLI), the LLM (DeepSeek-V4.1-Flash, GPT-6 Luna, GPT-6 Sol, and Claude Sonnet 5.5), and the reasoning effort. Beyond execution success (Pass@1), we assess behavioral adequacy with the developers' own test as the reference for the required behavior. Our primary metric, KillComplete@1, is the share of instances whose generated test both passes and kills every mutant that its ground-truth test kills, i.e., is kill-complete.

The experimental results show that current agents produce passing tests far more often than behaviorally adequate ones. The best-passing configuration, Codex CLI with DeepSeek-V4.1-Flash at high reasoning effort, passes 82.8% of instances but is kill-complete on only 33.8%. Three findings emerge: ① Returns diminish steeply: The returns in behavioral adequacy obtained by scaling up agents (e.g., increasing LLM scale) diminish with generation cost. For Codex CLI, moving from GPT-6 Luna to DeepSeek-V4.1-Flash and then to GPT-6 Sol increases the generation cost by factors of 6.0 and 4.9, yet changes KillComplete@1 by only +5.5 percentage points (pp) and then -2.5 pp (28.3% → 33.8% → 31.3%). ② Information gap between high-level requirements and concrete tests: 90–99% of passing but kill-incomplete tests fall short where the requirement leaves the setup ambiguous or the expected outcome tacit. ③ A requirement-grounded harness is required for reducing uncertainty in test generation: The best of three generations is kill-complete 8.6–10.2

Binhang Qi, Yiming Liu, Yun Lin, Yangjie Zhou, Hailong Sun, and Jin Song Dong

Table 1. Comparison of resources pairing requirement-like inputs with ground-truth test code. “Source” indicates whether an artifact was preserved from the subject project. “Hierarchy” indicates test levels and explicit requirement relations.

ResourceSourceGranularityEvaluation CriteriaHierarchySize
#Pairs#PLs
E2EDev [25]SyntheticScenario ↔\leftrightarrow Test Impl.N/AN/A7031
GivenWhenThen [21]RealFeature ↔\leftrightarrow Test FilesN/AN/A2,2893
AutoGlue [34]RealStep ↔\leftrightarrow MethodRef.-basedN/A1,3071
DevBench [24]ManualProject ↔\leftrightarrow Test FilesProg.-basedN/A224
REQ2TEST-BENCHRealScenario ↔\leftrightarrow Test Impl.Prog. & Ref.-based✓5,0865

pp more often than a single one, headroom for harnesses that exploit the non-determinism of LLM agents and can discriminate non-trivial from trivial differences between tests.

We make the following contributions:

  • We formulate repository-level requirement-to-test generation as a requirement-driven, interface-assisted task in which an LLM agent must synthesize one complete, potentially multi-file Test Implementation while the target implementation is withheld.

  • We construct and release REQ2TEST-BENCH, comprising 5,086 authentic, execution-validated Requirement–Test Implementation instances from 8 projects in 5 programming languages, and measure behavioral adequacy relative to the developers' own tests.

  • We evaluate eight agent–model–reasoning configurations that differ in the agent scaffold, the LLM, or the reasoning effort, uncover sharply diminishing returns and a persistent information gap, and identify promising directions for future research.

The code, data, and leaderboard are available in our repository [32].

References (14)