Automated Unit Test Refactoring
Yi Gao, Xing Hu, Xiaohu Yang, Xin Xia

TL;DR
This paper introduces UTRefactor, an innovative LLM-based framework that automates the refactoring of test smells in Java, significantly improving test code quality and reducing manual effort.
Contribution
The paper presents UTRefactor, a novel context-aware, chain-of-thought LLM approach with knowledge base integration for automated, accurate, and flexible test smell refactoring.
Findings
89% reduction in test smells
Outperforms rule-based refactoring tools by 61.82%
Effective in diverse Java projects
Abstract
Test smells arise from poor design practices and insufficient domain knowledge, which can lower the quality of test code and make it harder to maintain and update. Manually refactoring test smells is time-consuming and error-prone, highlighting the necessity for automated approaches. Current rule-based refactoring methods often struggle in scenarios not covered by predefined rules and lack the flexibility needed to handle diverse cases effectively. In this paper, we propose a novel approach called UTRefactor, a context-enhanced, LLM-based framework for automatic test refactoring in Java projects. UTRefactor extracts relevant context from test code and leverages an external knowledge base that includes test smell definitions, descriptions, and DSL-based refactoring rules. By simulating the manual refactoring process through a chain-of-thought approach, UTRefactor guides the LLM to…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Testing and Debugging Techniques · Advanced Computational Techniques and Applications · Educational Technology and Assessment
