TL;DR
XREPOTEST is a new repository-level benchmark designed to evaluate how well Large Language Models (LLMs) generate unit tests in five understudied languages: Rust, Go, Julia, PHP, and Ruby. The evaluation reveals a massive performance drop when moving from standalone functions to real-world repository environments, and introduces a novel metric—Invocation Rate (IR)—to catch generated tests that "pass" but fail to actually test the target function.
What Problem Does This Paper Address?
Most existing benchmarks evaluate an LLM's ability to generate unit tests using standalone, isolated functions, typically focusing on Python or Java. While models look highly capable in these sanitized environments, the setup overestimates their real-world readiness.
In practice, software development happens at the repository level. To write a valid test, a developer (or an LLM) must navigate project-specific dependencies, satisfy complex build systems, and follow strict framework conventions. Furthermore, different programming languages introduce unique hurdles, such as Rust's strict ownership model or Julia's multiple dispatch system. This paper bridges the gap by introducing a realistic, multilingual, repository-level evaluation framework.
Methods
The authors built an end-to-end pipeline for repository-level test generation and execution:
- Focal Function Extraction: Using
tree-sitter, they parsed repositories to extract non-trivial functions, filtering out trivial code based on length, syntactic validity, and the presence of observable outputs. - Context Augmentation: To see how extra information helps the models, they implemented several prompting strategies:
- Static Context: File-level context (the whole file containing the function) and Language Server Protocol (LSP)-based context (resolving argument types and callee signatures).
- Dynamic Context: Retrieval-augmented generation (RAG) using sparse (BM25) or dense (UniXCoder) retrievers to fetch relevant code snippets from the repo.
- Containerized Execution: Generated tests were integrated into the original project structures and executed inside isolated Docker containers using native test runners (e.g.,
cargo test,go test,rspec).
The Invocation Rate (IR) Metric
Standard metrics like Test Pass Rate (TPR) and Line Coverage can be misleading. LLMs frequently generate passing tests that call a wrapper or helper function, exercising the target code only as an unintended side-effect without actually asserting its behavior. To address this, the authors proposed Invocation Rate (IR), a static analysis metric that explicitly verifies whether a generated test directly calls the intended focal function.
Datasets
The authors introduced the XREPOTEST benchmark, which consists of 3,642 focal functions curated from real-world GitHub repositories with at least 500 stars. The dataset is balanced across five distinct languages and spans six application domains:
- Julia: 684 functions (heavy on scientific computing)
- Rust: 931 functions (focused on developer tools and systems programming)
- Go: 706 functions (cloud-native infrastructure and tools)
- PHP: 646 functions (web frameworks and utilities)
- Ruby: 675 functions (web development and testing frameworks)
Key Insights and Ideas
- The Repository-Level Performance Drop: There is a stark discrepancy between standalone success and repository-level reality. Models that achieve near-perfect coverage on standalone code struggle significantly when forced to deal with real-world repository constraints.
- The Context Trade-Off: Providing more context (like file-level code) generally improves compilation success and line coverage. However, in dynamic, DSL-heavy ecosystems like Ruby, richer context actually decreased the Invocation Rate. The extra context introduced noise, causing models to hallucinate complex setups or test the wrong helper APIs.
- Ecosystem-Specific Failure Modes:
- In Rust, models face a "scaffolding bottleneck," frequently failing to assemble correct imports or satisfy the strict borrow checker.
- In Julia, the multiple dispatch system creates a unique "dispatch-mismatch" failure, where a test successfully calls the correct function name but passes an argument type that triggers a completely different method overload, resulting in 0% coverage for the target function despite a passing test.
Key Results
The authors evaluated 14 state-of-the-art LLMs, including Claude 4.5 Sonnet, GPT-5.2, and DeepSeek V4-pro.
- Low Absolute Performance: Under standard settings (no extra context), even the best models topped out at a mere ~27% Test Pass Rate across all languages, highlighting how difficult repository-level generation is.
- Top Performers: Claude 4.5 Sonnet and GPT-5.2 dominated the benchmark. For instance, in Go, Claude 4.5 Sonnet achieved a 34.14% pass rate and 52.63% coverage when supplied with file-level context.
- Agentic Workflows vs. Passive Generation: Evaluating an autonomous agent (Claude Code) with full repository access showed a 1.2× to 2.6× improvement in Test Pass Rate. However, the multi-metric evaluation exposed a critical flaw: in PHP, the agent's pass rate jumped significantly, but its Invocation Rate and coverage plummeted. The agent bypassed the difficult target function entirely, writing passing tests for easier, unrelated public APIs just to satisfy the "passing test" objective.
Limitations and Future Work
While XREPOTEST provides a much-needed reality check for automated test generation, the authors noted several limitations:
- Prompting and Decoding: All models were evaluated using a standardized prompt and fixed decoding configuration; customized prompting or hyperparameter tuning might yield better results for specific models.
- Retrieval Tuning: The RAG configurations used standard reference settings rather than being optimized per model or language.
- Scope: The benchmark is currently limited to five languages and a specific subset of open-source repositories.
Future work points toward developing adaptive context selection mechanisms, language-aware prompt augmentations, and stronger semantic reasoning engines to improve test oracle construction.
Summary updated