UTFix: Change Aware Unit Test Repairing using LLM
Shanto Rahman, Sachit Kuhar, Berk Çirisci, Pranav Garg, Shiqi Wang, Xiaofei Ma, Anoop Deoras, Baishakhi Ray
Abstract
USA XIAOFEI MA, ANOOP DEORAS, and BAISHAKHI RAY, AWS, USA Software updates, including bug repair and feature additions, are frequent in modern applications but they often leave test suites outdated, resulting in undetected bugs and increased chances of system failures. A recent study by Meta revealed that 14%-22% of software failures stem from outdated tests that fail to reflect changes in the codebase. This highlights the need to keep tests in sync with code changes to ensure software reliability.
In this paper, we present UTFix, a novel approach for repairing unit tests when their corresponding focal methods undergo changes. UTFix addresses two critical issues: assertion failure and reduced code coverage caused by changes in the focal method. Our approach leverages language models to repair unit tests by providing contextual information such as static code slices, dynamic code slices, and failure messages. We evaluate UTFix on our generated synthetic benchmarks (Tool-Bench), and real-world benchmarks. Tool-Bench includes diverse changes from popular open-source Python GitHub projects, where UTFix successfully repaired 89.2% of assertion failures and achieved 100% code coverage for 96 tests out of 369 tests. On the real-world benchmarks, UTFix repairs 60% of assertion failures while achieving 100% code coverage for 19 out of 30 unit tests. To the best of our knowledge, this is the first comprehensive study focused on unit test in evolving Python projects. Our contributions include the development of UTFix, the creation of Tool-Bench and real-world benchmarks, and the demonstration of the effectiveness of LLM-based methods in addressing unit test failures due to software evolution.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext fa95f815-6572-487f-ba5d-ff52a214d9c9Cited by top-tier papers3
- When Specifications Meet Reality: Uncovering API Inconsistencies in Ethereum InfrastructureJie Ma, Ningyu He, Jinwen Xi, Mingzhe Xing et al.OOPSLA 2026
- Diffploit: Facilitating Cross-Version Exploit Migration for Open Source Library VulnerabilitiesZirui Chen, Zhipeng Xue, Jiayuan Zhou, Xing Hu et al.ICSE 2026
- Direct Manipulation and Natural Language Programming, Together at Last?Parker Ziegler, David Minh-Duy Cao, Justin Lubin, Sarah E. ChasinsOOPSLA 2026
Builds on8
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
- TOGA: A Neural Method for Test Oracle GenerationElizabeth Dinella, Gabriel Ryan, Todd Mytkowicz, Shuvendu K. LahiriICSE 2022 · 92 citations
- Code-Aware Prompting: A Study of Coverage-Guided Test Generation in Regression Setting using LLMGabriel Ryan, Siddhartha Jain, Mingyue Shang, Shiqi Wang et al.FSE 2024 · 68 citations
- Using pre-trained language models to resolve textual and semantic merge conflicts (experience paper)Jialu Zhang, Todd Mytkowicz, Mike Kaufman, Ruzica Piskac et al.ISSTA 2022 · 30 citations
- HITS: High-coverage LLM-based Unit Test Generation via Method SlicingZejun Wang, Kaibo Liu, Ge Li, Zhi JinASE 2024 · 29 citations
Related papers
- Unit Test Update through LLM-Driven Context Collection and Error-Type-Aware RefinementYuanhe Zhang, Zhiquan Yang, Shengyi Pan, Zhongxin LiuASE 2025 · 3 citations
- MuMuTestUp: Mutation-Based Multi-agent Test Case UpdateDawei Tian, Jiakun Liu, Yun Peng, Yichen Zhang et al.ISSTA 2026
- Comprehend, Imitate, and then Update: Unleashing the Power of LLMs in Test Suite EvolutionTangzhi Xu, Jianhan Liu, Yuan Yao, Cong Li et al.ASE 2025 · 1 citation
- On the Evaluation of Large Language Models in Unit Test Evolution (Experience Paper)Weichang Liu, Junwei Zhang, Yuqing Niu, Bo ZhouISSTA 2026
- CodeSync: Synchronizing Large Language Models with Dynamic Code Evolution at ScaleChenlong Wang, Zhaoyang Chu, Zhengxiang Cheng, Xuyi Yang et al.ICML 2025
