一句话:提出用生成-测试-修复智能体循环与多智能体协作,自动化静态方法重构、Mock 与单元测试生成,并集成到 CI 工作流。
静态类型语言(如 C#)中的静态方法调用常使方法难以测试。将此类调用重构为自定义类与接口可减少不可测代码,但对初级开发者陌生、对资深开发者繁琐;传统单元测试生成器和近期基于 LLM 的生成器难以自动化该重构与测试创建过程。该研究旨在探究生成-测试-修复的智能体循环、多智能体协作,及其融入持续集成工作流,以自动化重构与测试创建。最终目标是提升包含静态方法调用的生产代码的单元测试自动生成,实现准确的测试创建与重构,同时降低开发者的认知负担。
Code written in statically typed languages such as C# often contains static method calls that make methods untestable. Static method calls should be refactored into a custom class and interface to reduce untestable code. This refactoring effort may be unfamiliar to junior developers and tedious to developers with more experience. Traditional unit test generators and, more recently, LLM based unit test generators struggle to automate this refactoring and test creation process. This research aims to investigate the use of an agentic loop (generate, test, repair), multi-agent collaboration, and its incorporation into continuous integration workflows to automate refactoring and test creation. The ultimate goal of this research is to enhance the automated generation of unit tests for production code that includes static method calls, by facilitating accurate test creation and refactoring while minimizing the cognitive load on developers.