arXiv:2611.03197cs.SENov 2026

Manuscript Offprint

arXiv:2611.03197

Finding the Pivots to Repair Broken Source-Test Evolution Using LLMs

Xiao Chen, Songqiang Chen, Jialun Cao, Yun Peng, Chun Yong Chong, Shing-Chi Cheung

XIAO CHEN, The Hong Kong University of Science and Technology, China

SONGQIANG CHEN, The Hong Kong University of Science and Technology, China

JIALUN CAO, The Hong Kong University of Science and Technology, China

YUN PENG, Fudan University, China

CHUN YONG CHONG, Monash University Malaysia, Malaysia

SHING-CHI CHEUNG*, The Hong Kong University of Science and Technology, China

Repairing obsolete tests in response to source code evolution is critical for test suite reliability and software quality assurance. While large language models (LLMs) have emerged as promising tools for automating many software development tasks, the effective supply of context and the orchestration of repair pipelines in this source-test co-evolution scenario remain poorly understood. Moreover, although reasoning is found helpful for LLMs on some complex coding tasks, it remains unclear which reasoning steps actually contribute to effective test repairs and how the insights learned from LLMs' behaviors benefit coding agents. In this paper, we present a systematic empirical study of test repair for source-test co-evolution empowered by LLMs, investigating the effective setups and typical LLM behaviors. To support this study, we construct a new benchmark of 500 real-world source-test co-evolution cases from commits submitted between May 2024 and April 2026 across 15 highly-starred open-source Java projects. Our experimental results reveal several key insights for effective LLM-based test repair: the complementary benefits of combining test failure symptoms, source code changes, and supportive code context, as well as the effectiveness of self-repair rounds. We further derive a common reasoning action taxonomy from LLMs' reasoning traces, which proves instrumental in guiding LLMs to repair tests more effectively while at a lower financial cost. Applying our findings to the Codex agent further improves its repair success rate on challenging cases by 66.7%.

CCS Concepts: • Software and its engineering → Software testing and debugging; Software evolution.

Additional Key Words and Phrases: Source-Test Co-evolution, Test Repair, Large Language Models

ACM Reference Format:

Xiao Chen, Songqiang Chen, Jialun Cao, Yun Peng, Chun Yong Chong, and Shing-Chi Cheung. 2026. Finding the Pivots to Repair Broken Source-Test Evolution Using LLMs. 1, 1 (November 2026), 25 pages. https://doi.org/XXXXXXX.XXXXXXX

*Corresponding author.

Authors' Contact Information: Xiao Chen, xchenfu@cse.ust.hk, The Hong Kong University of Science and Technology, Hong Kong SAR, China; Songqiang Chen, i9s.chen@connect.ust.hk, The Hong Kong University of Science and Technology, Hong Kong SAR, China; Jialun Cao, jcaoap@cse.ust.hk, The Hong Kong University of Science and Technology, Hong Kong SAR, China; Yun Peng, yunp@fudan.edu.cn, Fudan University, Shanghai, China; Chun Yong Chong, Chong.chunyong@monash.edu, Monash University Malaysia, Subang Jaya, Malaysia; Shing-Chi Cheung, scc@cse.ust.hk, The Hong Kong University of Science and Technology, Hong Kong SAR, China.

Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from permissions@acm.org.

© 2026 Copyright held by the owner/author(s). Publication rights licensed to ACM.

ACM XXXX-XXXX/2026/11-ART

https://doi.org/XXXXXXX.XXXXXXX

Xiao Chen, Songqiang Chen, Jialun Cao, Yun Peng, Chun Yong Chong, and Shing-Chi Cheung

1 Introduction

In the development of software systems, test cases verify the correctness of code functionalities, serving as a standard for software quality assurance [5, 46, 59, 95]. However, during software evolution, tests can become outdated and incompatible with changes introduced to the system under test (SUT) [23, 39, 79, 92], causing compilation or runtime failures. Prior studies reported that broken test cases contribute to about one-fifth of failures in software systems [27, 76]. False alarms raised by these broken tests (i.e., failures caused by outdated test code rather than genuine SUT defects) can hinder the detection of real program faults [28, 38]. Therefore, timely repair of unit tests is essential for software sustainability [23, 28]. Nevertheless, manually updating unit tests in response to SUT changes is time-consuming and error-prone [23, 25, 44, 83], making automated test repair a practically important problem.

Automated source-test co-evolution (i.e., updating test code to match source code changes of the SUT) attracts much interest from researchers. Early source-test co-evolution techniques defined rules [9, 10, 35, 40–43, 86] that apply predefined transformation templates for typical types of code changes. To overcome the rigidity and costly build of hand-crafted rules, later researchers built neural models for test repair [21, 90], achieving broader applicability. Recently, large language models (LLMs) emerged as a more effective solution for test repair, showcasing promising performance due to their extensive code knowledge. They leverage context-aware test repair to tackle focal methods' signature changes [36], utilize runtime feedback [7, 85], and address both test breakage and test enhancement [56, 93]. More recently, MuMuTestUp [73] employs multiple LLM agents for mutation-guided repair of obsolete tests caused by the changes to a single focal method.

However, existing LLM-based test repair techniques primarily focus on scenarios involving changes to a single focal method, which is over-simplified compared to real-world co-evolution scenarios. By analyzing over 2,500 source-test co-evolution cases drawn from commits submitted within the past two years in highly-starred open-source Java projects, we characterize real-world co-evolution practices and observe that 70.9% of broken tests invoke multiple changed methods and 77.8% are accompanied by changes to invoked classes. These suggest that real-world source-test co-evolution is substantially more complex than the settings addressed by current techniques. Moreover, each technique proposes and evaluates one specific combination of repair context and pipeline design, leaving it unclear which design choices actually matter in such scenarios.

Existing empirical studies only partially answer this question. Prior studies have characterized whether, when, and why production and test code co-evolve [18, 54, 63, 92], but not how broken tests should be repaired. Very recent studies have begun to evaluate LLMs for test evolution, yet they either examine prompt design under single-focal-method changes [37] or focus on the overall performance of coding agents [60, 78].

Therefore, the practical problem of how to enable LLMs in test repair in such complex, realistic scenarios remains underexplored. In particular, several fundamental design choices remain unsettled: what repair context to supply; how the repair pipeline should be orchestrated; whether the explicit reasoning steps taken by the LLM with reasoning mode enabled, which prove helpful in many coding tasks [15, 32, 87, 88], contribute to its superior performance over the LLM with reasoning mode disabled, and which steps are most effective; how LLMs' repair performance varies across scenarios of increasing complexity; and whether the derived insights can generalize to autonomous coding agents and even further enhance their performance.

In this paper, we aim to find the pivots of LLM-based test repair: the key design choices and model behaviors that determine whether a broken test can be successfully repaired in realistic source-test co-evolution scenarios. To answer the above questions, we conduct a systematic empirical study on a new benchmark comprising 500 real-world source-test co-evolution cases from 15 well-maintained Java projects on GitHub [17], covering commits between May 2024 and April 2026, which provides a more up-to-date and realistic evaluation with larger scale and more complex co-evolution scenarios than existing benchmarks. We investigate five research questions (RQs) regarding the key design dimensions of LLM setups for test repair: (RQ1) we assess how three types of repair context (i.e., Symptoms, Cause, and Support) affect test repair performance; (RQ2) we compare the effectiveness of popular pipeline orchestration strategies (i.e., in-context learning (ICL), multi-attempt repair, and iterative refinement) for test repair; (RQ3) we quantify the contribution of explicit reasoning by evaluating the same model with reasoning mode enabled and disabled, and establish a taxonomy of reasoning actions, based on which we further distill the key reasoning steps to help LLMs repair test cost-effectively; (RQ4) we analyze how repair performance scales with repair scenario complexity by partitioning benchmark instances based on the scope of code under test (CUT) changes and the adaptations required in the tests' golden patch; and (RQ5) we examine whether the preceding findings generalize to agent-based test repair by measuring the improvement yield over a vanilla coding agent baseline.

Our experimental results yield several insights. Specifically, we found that combining multiple context types is an effective strategy for LLM-based test repair. We also found that both multi-attempt repair and iterative refinement pipelines enhance LLMs' performance, while feedback from prior attempts can more efficiently guide the repair process, particularly during the initial self-check round. In addition, we derive a taxonomy of 14 common reasoning action patterns organized across four stages, revealing the reasoning behaviors that underlie the superior repair performance of the LLM with reasoning mode enabled over disabled. Based on this taxonomy, we successfully guide LLMs to repair tests effectively at a lower cost. Finally, our empirically validated findings translate into enhanced agent-based repair, achieving a 66.7% relative improvement on challenging cases.

To summarize, this paper makes the following contributions:

  • Empirical Study: We present a systematic empirical study on LLM-based test repair for source-test co-evolution, spanning repair context, pipeline orchestration, reasoning model behavior, scenario complexity, and generalization to the agent, organized by five research questions.
  • Benchmark: We construct a new benchmark for source-test co-evolution, comprising 500 dynamically validated, recent instances from 15 highly-starred open-source projects, addressing key limitations of existing benchmarks.
  • Practical Guidelines: We derive actionable guidelines for designing effective LLM-based test repair approaches, grounded in systematic empirical evidence across diverse co-evolution scenarios. We demonstrate that the findings can be translated into tangible improvements for agent-based test repair.

References (38)