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

基于大语言模型的接受测试生成:一项工业案例研究

Acceptance Test Generation with Large Language Models: An Industrial Case Study

Critical TechWorks;Faculty of Engineering, University of Porto(波尔图大学工程学院);INESC TEC;LIACC

Margarida Ferreira, Luis Viegas, Joao Pascoal Faria, Bruno Lima

AI总结:

本文研究了利用大语言模型生成Web应用验收测试的两步方法,通过工业案例验证了其在提高测试质量和效率方面的有效性。

摘要:

大语言模型(LLM)辅助的助手越来越多地用于生成程序代码和单元测试,但其在验收测试中的应用仍处于探索阶段。为弥补这一差距,本文探讨了利用LLM为Web应用程序生成可执行的验收测试的两步过程:(i)从用户故事中生成自然语言的验收测试场景(用Gherkin表示),(ii)将这些场景转换为可执行的测试脚本(用Cypress表示),已知待测试页面的HTML代码。这种两步方法支持验收测试驱动开发,增强测试人员的控制力,并提高测试质量。这两步分别在AutoUAT和Test Flow工具中实现,由GPT-4 Turbo驱动,并整合到一家合作伙伴公司的流程中,并在真实项目上进行了评估。用户发现AutoUAT生成的验收测试场景有95%的时间是有帮助的,甚至揭示了之前未被注意到的案例。关于Test Flow,92%的生成的验收测试用例被认为是有帮助的:60%可以直接使用,8%需要少量修改,24%需要重新生成并添加额外输入;剩下的8%由于主要问题被丢弃。这些结果表明,LLM确实可以通过适当的工具和监督来帮助改进验收测试流程。

英文摘要:

Large language model (LLM)-powered assistants are increasingly used for generating program code and unit tests, but their application in acceptance testing remains underexplored. To help address this gap, this paper explores the use of LLMs for generating executable acceptance tests for web applications through a two-step process: (i) generating acceptance test scenarios in natural language (in Gherkin) from user stories, and (ii) converting these scenarios into executable test scripts (in Cypress), knowing the HTML code of the pages under test. This two-step approach supports acceptance test-driven development, enhances tester control, and improves test quality. The two steps were implemented in the AutoUAT and Test Flow tools, respectively, powered by GPT-4 Turbo, and integrated into a partner company's workflow and evaluated on real-world projects. The users found the acceptance test scenarios generated by AutoUAT helpful 95% of the time, even revealing previously overlooked cases. Regarding Test Flow, 92% of the acceptance test cases generated by Test Flow were considered helpful: 60% were usable as generated, 8% required minor fixes, and 24% needed to be regenerated with additional inputs; the remaining 8% were discarded due to major issues. These results suggest that LLMs can,in fact, help improve the acceptance test process with appropriate tooling and supervision.

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

↑