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

APITestGenie: 从需求和API规范生成Web API测试

APITestGenie: Generating Web API Tests from Requirements and API Specifications with LLMs

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

André Pereira, Bruno Lima, João Pascoal Faria

AI总结:

本文提出APITestGenie工具,利用LLM、RAG和提示工程从业务需求和OpenAPI规范自动生成API测试,测试覆盖率达89%,发现API缺陷,提升测试与需求的一致性。

摘要:

现代软件系统依赖Web API,但创建有意义且可执行的测试脚本仍是一个手动、耗时且易出错的任务。本文提出了APITestGenie,一种利用大型语言模型(LLMs)、检索增强生成(RAG)和提示工程的新型工具,可直接从业务需求和OpenAPI规范自动生成API集成测试。我们在10个真实世界API上评估了APITestGenie,包括8个来自汽车行业的API,涵盖约1,000个活跃端点。工具在最多三次尝试后,能够为89%的业务需求生成语法和语义有效的测试脚本。值得注意的是,一些生成的测试揭示了API中之前未知的缺陷,包括端点之间的集成问题。统计分析确定API复杂性和业务需求的详细程度是影响成功率的主要因素,API文档的详细程度也影响了结果。行业从业者反馈确认了对采用的强烈兴趣,显著减少了编写验收测试的手动工作量,并提高了测试与业务需求的一致性。

英文摘要:

Modern software systems rely heavily on Web APIs, yet creating meaningful and executable test scripts remains a largely manual, time-consuming, and error-prone task. In this paper, we present APITestGenie, a novel tool that leverages Large Language Models (LLMs), Retrieval-Augmented Generation (RAG), and prompt engineering to automatically generate API integration tests directly from business requirements and OpenAPI specifications. We evaluated APITestGenie on 10 real-world APIs, including 8 APIs comprising circa 1,000 live endpoints from an industrial partner in the automotive domain. The tool was able to generate syntactically and semantically valid test scripts for 89\% of the business requirements under test after at most three attempts. Notably, some generated tests revealed previously unknown defects in the APIs, including integration issues between endpoints. Statistical analysis identified API complexity and level of detail in business requirements as primary factors influencing success rates, with the level of detail in API documentation also affecting outcomes. Feedback from industry practitioners confirmed strong interest in adoption, substantially reducing the manual effort in writing acceptance tests, and improving the alignment between tests and business requirements.

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

↑