arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2610.35297cs.SE
收藏

编码智能体测试:智能体支持与人工编写的拉取请求的大规模对比

Testing with Coding Agents: A Large-Scale Comparison of Agent-Supported and Human-Authored Pull Requests

Politecnico di Torino(都灵理工大学);University of Molise(莫利塞大学);University of Minnesota(明尼苏达大学)

Roberto Milanese, Francesco Salzano, Hovhannes Muradyan, Jingjing Wu, Remo Pareschi, Fausto Fasano, Mattia Fazzini

AI总结:

该研究对比智能体支持与人工编写的拉取请求,分析11万余个Java代码库的拉取请求,发现智能体支持型拉取请求变更测试的几率更高,添加测试更多,修改删除更少,测试覆盖率存在部分差异,其与测试质量的关系仍不确定。

摘要:

背景:编码智能体越来越多地通过开发者后续维护的拉取请求贡献测试,因此测试工作的划分方式会影响长期可维护性。目标:我们从五个维度对比开发者与编码智能体协作的拉取请求(智能体支持型)和无 detectable 智能体参与的拉取请求(人工编写型),这五个维度分别是测试变更的频率与范围、类型与上下文、测试结构、测试异味以及代码覆盖率。方法:我们分析了2025年1月至2026年4月间391个Java代码库中已合并的114134个拉取请求,通过拉取请求级别和提交级别的信号识别出五种编码智能体。由于不同项目的智能体采用情况存在差异,我们在代码库内使用混合效应模型对比两组结果,同时控制变更规模。结果:跨代码库汇总来看,两组变更测试代码的频率几乎相同;在代码库内部,智能体支持型拉取请求变更测试代码的几率是人工编写型的1.65倍。智能体支持型拉取请求更常添加测试(几率比为1.50-1.58),而修改(0.70-0.76)和删除(0.51-0.77)测试的频率更低。我们未检测到两组新增测试在多数结构特征上的差异,智能体支持型拉取请求的测试更常包含预言(oracle);在可构建的95个代码库中,两组测试对生产变更的覆盖率无差异;但在仅修改测试的拉取请求中,智能体支持型的测试对所执行代码的覆盖率更低。两组在测试异味上的差异接近显著,且无法在单个测试方法中复现。结论:智能体参与与不同的测试工作组合相关,跨项目的汇总对比可能掩盖或反转这种差异;智能体参与与测试质量的关系仍不确定。

英文摘要:

Context. Coding agents increasingly contribute tests through pull requests that developers then maintain, so how testing work is divided affects long-term maintainability. Objective. We compare pull requests in which developers and coding agents collaborate (agent-supported) with pull requests without detectable agent involvement (human-authored) along five dimensions: the frequency and extent of test changes, their type and context, test structure, test smells, and code coverage. Method. We analyze 114,134 pull requests merged between January 2025 and April 2026 in 391 Java repositories, identifying five coding agents through pull-request-level and commit-level signals. Since agent adoption varies across projects, we compare the two groups within repositories with mixed-effects models that control for change size. Results. Pooled across repositories, both groups change test code almost equally often; within repositories, the odds that an agent-supported pull request does so are 1.65 times higher. Agent-supported pull requests add tests more often (odds ratios 1.50-1.58) and modify (0.70-0.76) and delete (0.51-0.77) them less often. We detect no difference in most structural characteristics of the tests they add, which more often have an oracle, nor, in the 95 repositories we could build, in the coverage of their production changes; in test-only pull requests, however, their tests cover less of the code they exercise. Differences in test smells are borderline and not reproduced for individual test methods. Conclusions. Agent participation is associated with a different mix of testing work, which pooled comparisons across projects can hide or reverse; its relationship with test quality remains uncertain.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑