arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2405.10849cs.SE
收藏

面向测试驱动开发的生成式AI:初步结果

Generative AI for Test Driven Development: Preliminary Results

Moritz Mock, Jorge Melegati, Barbara Russo

AI总结:

本研究针对测试驱动开发(TDD)应用成本高、依赖经验开发者的问题,提出结合生成式AI的协作与全自动两种TDD自动化模式,经ChatGPT实验验证其可提升TDD效率,但需监督代码质量以防误导非专业开发者。

摘要:

测试驱动开发(Test Driven Development, TDD)是极限编程的核心实践之一,该方法通过增量式测试与重构推动代码开发。TDD在行业中的应用较为有限,因为它需要编写更多代码,且依赖经验丰富的开发者。生成式AI(Generative AI, GenAI)或许能降低TDD带来的额外工作量。本研究提出一种自动化TDD的方法,采用两种GenAI应用模式:一种是协作交互模式,由开发者编写测试并在每次迭代中监督AI生成过程;另一种是全自动化模式,开发者仅在所有迭代结束后监督AI生成结果。我们以ChatGPT为工具开展探索性实验,将两种交互模式与无AI辅助的TDD在测试与代码质量、开发速度方面进行对比。总体而言,在本次实验及设置下,GenAI可高效应用于TDD,但需要对生成代码的质量进行监督。在某些情况下,它甚至可能误导非专业开发者,为了迎合查询而提出并不可靠的解决方案。

英文摘要:

Test Driven Development (TDD) is one of the major practices of Extreme Programming for which incremental testing and refactoring trigger the code development. TDD has limited adoption in the industry, as it requires more code to be developed and experienced developers. Generative AI (GenAI) may reduce the extra effort imposed by TDD. In this work, we introduce an approach to automatize TDD by embracing GenAI either in a collaborative interaction pattern in which developers create tests and supervise the AI generation during each iteration or a fully-automated pattern in which developers only supervise the AI generation at the end of the iterations. We run an exploratory experiment with ChatGPT in which the interaction patterns are compared with the non-AI TDD regarding test and code quality and development speed. Overall, we found that, for our experiment and settings, GenAI can be efficiently used in TDD, but it requires supervision of the quality of the produced code. In some cases, it can even mislead non-expert developers and propose solutions just for the sake of the query.

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

↑