Testing Method Relocation Algorithms via Template-Based Systematic Structural Traversal and Precondition Filtering
Chunhao Dong, Yanjie Jiang, Yang Zhang, Hui Liu
摘要
Method relocation refactorings, primarily Move Method and Pull Up/Push Down Method, are indispensable for reducing coupling and enhancing cohesion. Despite their widespread automation in modern refactoring engines, these algorithms remain notoriously error-prone, posing significant risks to software reliability. A primary challenge in testing them lies in the vast search space of complex program structures and the intricate preconditions required for safe method relocation. To address this, we propose RelocTest, a comprehensive testing framework that combines template-driven structural traversal with automated precondition filtering. RelocTest systematically explores the input space by populating program templates specially designed for method relocation through a two-stage generation process: (1) Skeleton Synthesis, which systematically traverses diverse syntactic structures, and (2) LLM-Guided Completion, which leverages Large Language Models to inject diverse, executable code into these skeletons. This hybrid strategy ensures high structural coverage while maintaining test program validity. Furthermore, to optimize testing efficiency, we introduce an LLM-based Precondition Extractor that analyzes the implementation of method relocation algorithms to identify and prune test programs destined for rejection. We evaluated RelocTest on 7 mainstream refactoring engines. Our approach successfully uncovered 56 previously unknown bugs, with 19 already confirmed by tool vendors, demonstrating its effectiveness in hardening industrial-strength refactoring tools.
问问这篇 Paper
问问你的智能体。
Lune 读过与它相关的顶会 Paper,每个回答都会注明依据哪几篇。
相关 Paper
- Cross-Refactoring-Type Test Program Migration for Refactoring EnginesChunhao Dong, Yanjie Jiang, Yang Zhang, Yuxia Zhang 等FSE 2026
- Chatgpt-Based Test Generation for Refactoring Engines Enhanced by Feature Analysis on ExamplesChunhao Dong, Yanjie Jiang, Yuxia Zhang, Yang Zhang 等ICSE 2025 · 被引用 4 次
- Let's Revise Step-by-Step: A Unified Local Search Framework for Code Generation with LLMsZhiyi Lyu, Jianguo Huang, Yanchen Deng, Steven Hoi 等NeurIPS 2025 · 被引用 7 次
- LLMSQLMUTATOR: LLM-Powered Test Case Generation for Database Using Bug ReportsChenglin Tian, Chaofan Li, Yawen Li, Yingxia ShaoICDE 2026
- Clozemaster: Fuzzing Rust Compiler by Harnessing Llms for Infilling Masked Real ProgramsHongyan Gao, Yibiao Yang, Maolin Sun, Jiangchang Wu 等ICSE 2025 · 被引用 6 次
