As software systems evolve, test cases must adapt to code changes to remain valid and effective. Traditional test migration approaches, including symbolic execution and diff-based heuristics, often require significant manual effort and struggle to handle complex behavioral changes. Recent advances in large language models (LLMs) offer new opportunities for context-aware and automated test adaptation. However, existing LLM-based approaches are not well-suited for test case migration under evolving code, as they typically lack explicit modeling of code changes and original test context. In this paper, we present TestCaseMig, a framework that integrates LLMs with static analysis to migrate existing test cases in response to code modifications. TestCaseMig constructs change-sensitive, context-rich prompts and employs a multi-round, feedback-driven generation process with validation and coverage analysis to ensure the correctness, completeness, and adaptability of migrated test cases.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

TestCaseMig: LLM-Driven Test Case Migration for Evolving Codebases

  • Wuhe Axi,
  • Xin Li,
  • Jigang Xie,
  • Xitao Li,
  • Haijun Wang

摘要

As software systems evolve, test cases must adapt to code changes to remain valid and effective. Traditional test migration approaches, including symbolic execution and diff-based heuristics, often require significant manual effort and struggle to handle complex behavioral changes. Recent advances in large language models (LLMs) offer new opportunities for context-aware and automated test adaptation. However, existing LLM-based approaches are not well-suited for test case migration under evolving code, as they typically lack explicit modeling of code changes and original test context. In this paper, we present TestCaseMig, a framework that integrates LLMs with static analysis to migrate existing test cases in response to code modifications. TestCaseMig constructs change-sensitive, context-rich prompts and employs a multi-round, feedback-driven generation process with validation and coverage analysis to ensure the correctness, completeness, and adaptability of migrated test cases.