paperbot · PL 论文追踪

全部论文 待读 收藏

P2 MUT: Human-in-the-Loop Unit Test Migration

MUT:人在回路的单元测试迁移
ICSE Proceedings of the IEEE/ACM 46th International Conference on Software Engineering2024匹配度 2/10 · 该论文研究跨语言单元测试迁移,属于软件测试与代码翻译工程,虽涉及代码映射和AST转换,但未聚焦静态分析、浮点程序分析、贝叶斯程序分析,也未与LLM/Agent结合。引用 5 inbox
Yi Gao, Xing Hu, Tongtong Xu, Xin Xia, David Lo, Xiaohu Yang
crossref: 2026-09-12

AI 速览

一句话:提出跨语言跨平台的人机协同单元测试迁移方法 MUT,复用测试并发现缺陷。

源代码级单元测试迁移长期缺乏探索。本文提出跨语言、跨平台的测试迁移方法 MUT,包含代码映射、测试用例过滤、测试用例翻译与测试用例适配四个模块:先建立源项目与目标项目的代码关联并筛选可迁移测试,再解析待迁移代码生成语法树并逐节点转换,最终在目标项目中编译执行;同时提供 Web 工具辅助开发者。作者在五个开源功能领域项目上迁移 550 个单元测试并提交 PR,其中 253 个已被合并;运行迁移测试发现 5 个 bug 与 2 个功能缺陷,表明该方法可行且有益。

问题
源代码层面的跨语言、跨平台单元测试迁移尚未得到充分关注与探索,测试用例难以复用。
方法
MUT 通过代码映射、测试用例过滤、基于语法树的测试翻译和测试适配四模块实现迁移,并开发 Web 工具辅助人工流程。
评估
在五个开源功能领域项目中迁移 550 个单元测试并提交 PR,253 个被合并,运行后发现 5 个 bug 和 2 个功能缺陷。
原文摘要(Abstract)

Test migration, which enables the reuse of test cases crafted with knowledge and creativity by testers across various platforms and programming languages, has exhibited effectiveness in mobile app testing. However, unit test migration at the source code level has not garnered adequate attention and exploration. In this paper, we propose a novel cross-language and cross-platform test migration methodology, named MUT, which consists of four modules: code mapping, test case filtering, test case translation, and test case adaptation. MUT initially calculates code mappings to establish associations between source and target projects, and identifies suitable unit tests for migration from the source project. Then, MUT's code translation component generates a syntax tree by parsing the code to be migrated and progressively converts each node in the tree, ultima tely generating the target tests, which are compiled and executed in the target project. Moreover, we develop a web tool to assist developers in test migration. The effectiveness of our approach has been validated on five prevalent functional domain projects within the open-source community. We migrate a total of 550 unit tests and submitted pull requests to augment test code in the target projects on GitHub. By the time of this paper submission, 253 of these tests have already been merged into the projects (including 197 unit tests in the Luliyucoordinate-LeetCode project and 56 unit tests in the Rangerlee-HtmlParser project). Through running these tests, we identify 5 bugs, and 2 functional defects, and submitted corresponding issues to the project. The evaluation substantiates that MUT's test migration is both viable and beneficial across programming languages and different projects.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot11451,
  title = {MUT: Human-in-the-Loop Unit Test Migration},
  author = {Yi Gao and Xing Hu and Tongtong Xu and Xin Xia and David Lo and Xiaohu Yang},
  booktitle = {ICSE},
  year = {2024},
  doi = {10.1145/3597503.3639124}
}