arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2501.08598cs.SEcs.AI
收藏

LlamaRestTest:基于小语言模型的有效 REST API 测试

LlamaRestTest: Effective REST API Testing with Small Language Models

Georgia Institute of Technology(佐治亚理工学院);IBM Research(IBM研究院)

Myeongsoo Kim, Saurabh Sinha, Alessandro Orso

AI总结:

提出 LlamaRestTest 方法,通过微调和量化 Llama3-8B 模型生成真实测试输入并揭示参数依赖,实验证明小语言模型在 REST API 测试中优于大模型及现有工具。

摘要:

现代 Web 服务严重依赖 REST API,这些 API 通常使用 OpenAPI 规范进行文档化。该标准的广泛采用促使了许多黑盒测试工具的开发,这些工具基于 OpenAPI 规范生成测试。尽管大型语言模型(LLMs)已展现出令人期待的测试生成能力,但它们在 REST API 测试中的应用在很大程度上仍未被探索。我们提出了 LlamaRestTest,这是一种新颖的方法,它采用了两个定制的 LLM——这些模型是通过使用挖掘到的 REST API 示例值和参数间依赖关系数据集,对 Llama3-8B 模型进行微调和量化而创建的——来生成真实的测试输入,并通过分析服务器响应在测试过程中揭示参数间的依赖关系。我们在 12 个真实世界的服务(包括 Spotify 等流行服务)上评估了 LlamaRestTest,并将其与 RESTGPT(一种由 GPT 驱动的规范增强工具)以及多种最先进的 REST API 测试工具进行了比较,包括 RESTler、MoRest、EvoMaster 和 ARAT-RL。我们的结果表明,微调使得较小的模型在检测可操作的参数依赖规则和为 REST API 测试生成有效输入方面,能够优于大得多的模型。我们还评估了从基础的 Llama3-8B 模型到微调版本的不同工具配置,并探索了多种量化技术,包括 2-bit、4-bit 和 8-bit 整数格式。我们的研究表明,在 REST API 测试中,小语言模型的表现可以与大语言模型一样好甚至更好,从而平衡了有效性和效率。此外,LlamaRestTest 在实现的代码覆盖率和识别的内部服务器错误方面优于最先进的 REST API 测试工具,即使这些工具使用了 RESTGPT 增强的规范。

英文摘要:

Modern web services rely heavily on REST APIs, typically documented using the OpenAPI specification. The widespread adoption of this standard has resulted in the development of many black-box testing tools that generate tests based on OpenAPI specifications. Although Large Language Models (LLMs) have shown promising test-generation abilities, their application to REST API testing remains mostly unexplored. We present LlamaRestTest, a novel approach that employs two custom LLMs-created by fine-tuning and quantizing the Llama3-8B model using mined datasets of REST API example values and inter-parameter dependencies-to generate realistic test inputs and uncover inter-parameter dependencies during the testing process by analyzing server responses. We evaluated LlamaRestTest on 12 real-world services (including popular services such as Spotify), comparing it against RESTGPT, a GPT-powered specification-enhancement tool, as well as several state-of-the-art REST API testing tools, including RESTler, MoRest, EvoMaster, and ARAT-RL. Our results demonstrate that fine-tuning enables smaller models to outperform much larger models in detecting actionable parameter-dependency rules and generating valid inputs for REST API testing. We also evaluated different tool configurations, ranging from the base Llama3-8B model to fine-tuned versions, and explored multiple quantization techniques, including 2-bit, 4-bit, and 8-bit integer formats. Our study shows that small language models can perform as well as, or better than, large language models in REST API testing, balancing effectiveness and efficiency. Furthermore, LlamaRestTest outperforms state-of-the-art REST API testing tools in code coverage achieved and internal server errors identified, even when those tools use RESTGPT-enhanced specifications.

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

↑