Manuscript Offprint

arXiv:2608.25939

XREPOTEST: Benchmarking Multilingual Repository-Level Unit Test Generation for Large Language Models

Dung Le Quang, Dong Cao Van, Nam Le Hai, Linh Ngo Van, Anh M. T. Bui, Phuong T. Nguyen

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Large language models (LLMs) have shown promise for automated unit test generation, but existing evaluations largely rely on standalone settings and a narrow set of programming languages, overestimating real-world readiness. We introduce XREPOTEST, a multilingual (i.e., covering multiple programming languages) repository-level benchmark for unit test generation spanning five underexplored languages: Rust, Go, Julia, PHP, and Ruby. XREPOTEST evaluates tests under realistic repository constraints using a containerized execution framework and multiple context augmentation strategies, including file-level, LSP-based, and retrieval-based context. Beyond standard metrics such as test pass rate and coverage, we propose Invocation Rate (IR) to assess whether generated tests meaningfully exercise the intended functionality. Experiments with 14 state-of-the-art LLMs (e.g., Claude 4.5, GPT-5.2, DeepSeek V4-pro, and Qwen families) reveal a substantial gap between standalone and repository-level performance, as well as trade-offs between richer context and test reliability. Overall, XREPOTEST provides a challenging and informative benchmark to advance scalable and robust unit test generation in realistic software environments. The dataset and code are publicly available at: XREPOTEST.

1 Introduction

Writing unit tests is a time-consuming yet critical part of software development (Yuan et al., 2023; Pan et al., 2025; Mohapatra, 2025); studies estimate it can take around 15% of a developer's time. This has motivated decades of research into automated unit test generation. Traditional approaches (Fraser and Arcuri, 2011; Lukasczyk and Fraser, 2022; Noller et al., 2018; Ognawala et al., 2019; Fraser and Arcuri, 2025) (e.g., search-based, symbolic, or random test generation) can produce tests

Figure

Figure 1: The Performance Gap: While LLMs achieve high pass rate and coverage on standalone settings (Gray), performance drops significantly in the repository-level XREPOTEST benchmark (Red).

with reasonable coverage, but these auto-generated tests often suffer from poor readability and trivial or ineffective assertions. Recently, large language models (LLMs) have emerged as a promising alternative, significantly accelerating unit test generation and often producing more natural, human-like test cases (Schäfer et al., 2023; Lemieux et al., 2023; Alagarsamy et al., 2024; Pan et al., 2025; Yuan et al., 2024; Watson et al., 2020; Tufano et al., 2022b; Dakhel et al., 2024; Siddiq et al., 2024; Bhatia et al., 2024; Li and Yuan, 2024; Serra et al., 2019; Yang et al., 2026; Le Hai et al., 2025; Zhang et al., 2024; Yang et al., 2024). Although LLMs have been widely adopted for unit test generation, their evaluation still faces significant challenges in practical applicability and multilingual adaptability. Existing test generation benchmarks often fail to reflect realistic repository-level constraints and remain biased toward a small set of programming languages, limiting our understanding of how LLMs perform in domain-specific and language-diverse software systems.

∗^{*}Equal contribution.

†^{\dagger}Corresponding author: namlh@soict.hust.edu.vn

First, various existing unit test generation benchmarks operate at the standalone, function-level, isolating code from the repository contexts in which real-world tests are written and executed (Chai et al., 2025; Wang et al., 2025; Chen et al., 2021). In these settings, models are not required to interact with realistic build systems, dependency graphs, or framework conventions, leading to an inflated impression of readiness for practical deployment. Figure 1 illustrates this discrepancy: strong performance on standalone benchmarks (i.e., McEval (Chai et al., 2025)) can substantially overestimate model effectiveness when tests must be generated and executed within real repositories. In repository-level settings, a model must not only write syntactically plausible tests, but also resolve project-specific dependencies, follow framework conventions, satisfy build systems, and construct valid inputs and assertions under incomplete context. These requirements sharply reduce both feasibility and semantic correctness, revealing a persistent gap between standalone success and real-world unit test generation.

Second, although some recent frameworks and benchmarks consider repository-level test generation scenarios, they remain disproportionately centered on Java and Python (Schäfer et al., 2023; Pan et al., 2025; Jain et al., 2025a). This narrow language focus limits the evaluation of LLM-based test generation methods across diverse programming ecosystems, hindering the development and assessment of tools that are generalizable and practically useful in multilingual software environments (Celik and Mahmoud, 2025). Meanwhile, different programming languages exhibit distinct characteristics and domain-specific usage patterns. For instance, Rust has rapidly become a standard choice for memory-safe systems programming; Go underpins much of cloud-native infrastructure; Julia is driving advances in high-performance scientific computing; and PHP and Ruby continue to power a substantial portion of production web applications (Myklebust et al., 2025; Gäher et al., 2024; Collins et al., 2025). These languages also introduce unique technical challenges; such as Rust's ownership and borrowing model, that can invalidate generation strategies effective in more conventional language settings (Cheng et al., 2025).

To bridge these gaps, we introduce XRE-POTEST, a large-scale multilingual 1^{1}, repository-level benchmark for unit test generation spanning five high-impact yet underexplored languages: Rust, Go, Julia, PHP, and Ruby. XREPOTEST provides rich repository context and systematically evaluates multiple context strategies, including retrieval-based, file-level, and LSP-based augmentation, revealing trade-offs between test effectiveness and invocation reliability. In addition, we propose Invocation Rate (IR) as a complementary metric to pass rate and coverage, enabling a more faithful assessment of whether generated tests truly exercise the intended functionality. Our comprehensive experiments reveal that in the standard setting, performance is primarily bottlenecked by API hallucinations; while enhancing context improves pass rates and coverage, it often introduces noise that reduces IR, highlighting a complex trade-off between test effectiveness and reliability. In summary, our contributions are as follows:

• Benchmarking Multilingual Repo-level Test Generation: We present XREPOTEST, a curated benchmark of over 3,642 focal functions from real-world Rust, Go, Julia, PHP, and Ruby repositories, designed to reflect diverse, real-world project code and testing conventions across these ecosystems.

• Comprehensive Evaluation Framework: We provide a containerized evaluation framework that automatically sets up and executes generated tests across all considered languages. Our framework enables reliable, execution-based evaluation using four standard metrics: test pass rate (TPR), compilation success rate (CSR), line coverage, and mutation score; and introduces a novel invocation rate (IR) to identify cases where tests pass but fail to meaningfully exercise the focal function, potentially introducing low-quality tests and technical debt.

• Repository-aware Context: To examine the influence of varying context, our framework and dataset provide rich metadata and tooling to support both static and dynamic context enhancement. Static context includes File-level context and LSP-based symbol resolution (e.g., argument

1^{1}Throughout this paper, “multilingual” denotes coverage across programming languages (Rust, Go, Julia, PHP, and Ruby), not natural languages. Thus, “language coverage” and “representation” refer exclusively to programming-language ecosystems in our benchmark, distinct from NLP notions of human-language representation.

Figure

Figure 2: Overview of the XREPOTEST benchmark construction and context-aware evaluation workflow. Left: Benchmark construction and evaluation. Repositories are selected, parsed, and filtered to construct the benchmark, after which generated unit tests are executed in containerized, language-native environments for reproducible repository-level evaluation. Right: Context for prompt construction.

types and dependency definitions), while dynamic context is enabled via retrieval-augmented approaches using both sparse and dense retrieval methods.

• Extensive LLMs Evaluation: We conduct comprehensive experiments on 14 state-of-the-art LLMs spanning families and scales, evaluating diverse context configurations. Our analysis reveals systematic strengths and limitations of current models and demonstrates how context design critically shapes the quality of generated tests.

References (14)