Leveraging Large Language Models to Improve REST API Testing
Abstract
The widespread adoption of REST APIs, coupled with their growing complexity and size, has led to the need for automated REST API testing tools. Current tools focus on the structured data in REST API specifications but often neglect valuable insights available in unstructured natural-language descriptions in the specifications, which leads to suboptimal test coverage. Recently, to address this gap, researchers have developed techniques that extract rules from these human-readable descriptions and query knowledge bases to derive meaningful input values. However, these techniques are limited in the types of rules they can extract and prone to produce inaccurate results. This paper presents RESTGPT, an innovative approach that leverages the power and intrinsic context-awareness of Large Language Models (LLMs) to improve REST API testing. RESTGPT takes as input an API specification, extracts machine-interpretable rules, and generates example parameter values from natural-language descriptions in the specification. It then augments the original specification with these rules and values. Our evaluations indicate that RESTGPT outperforms existing techniques in both rule extraction and value generation. Given these promising results, we outline future research directions for advancing REST API testing through LLMs.
Empirical ResultsBrowse all benchmarks →
| Benchmark | Method | Metric | Score | Protocol / Evidence |
|---|---|---|---|---|
| NLP2REST comparison | NLP2REST (without validation module) | precision | 50% | split: valSource quoteL18: Our preliminary results demonstrate the significant advantage of our approach over existing tools. Compared to NLP2REST without the validation module, our method improves precision from 50% to 97%. Even when compared to NLP2REST equipped with its validation module, our approach still increases precision from 79% to 97%. Additionally, RESTGPT successfully generates both syntactically and semantically valid inputs for 73% of the parameters over the analyzed services and their operations, a considerable improvement over ARTE, which could generate valid inputs for 17% of the parameters only. Given these encouraging results, we outline a number of research directions for leveraging LLMs in other ways for further enhancing REST API testing. |
| NLP2REST comparison | RESTGPT | precision | 97% | split: valSource quoteL18: Our preliminary results demonstrate the significant advantage of our approach over existing tools. Compared to NLP2REST without the validation module, our method improves precision from 50% to 97%. Even when compared to NLP2REST equipped with its validation module, our approach still increases precision from 79% to 97%. Additionally, RESTGPT successfully generates both syntactically and semantically valid inputs for 73% of the parameters over the analyzed services and their operations, a considerable improvement over ARTE, which could generate valid inputs for 17% of the parameters only. Given these encouraging results, we outline a number of research directions for leveraging LLMs in other ways for further enhancing REST API testing. |
| NLP2REST comparison | NLP2REST (with validation module) | precision | 79% | split: valSource quoteL18: Our preliminary results demonstrate the significant advantage of our approach over existing tools. Compared to NLP2REST without the validation module, our method improves precision from 50% to 97%. Even when compared to NLP2REST equipped with its validation module, our approach still increases precision from 79% to 97%. Additionally, RESTGPT successfully generates both syntactically and semantically valid inputs for 73% of the parameters over the analyzed services and their operations, a considerable improvement over ARTE, which could generate valid inputs for 17% of the parameters only. Given these encouraging results, we outline a number of research directions for leveraging LLMs in other ways for further enhancing REST API testing. |
| Analyzed services and their operations | RESTGPT | parameters with syntactically and semantically valid inputs | 73% | Parameter value generation across the analyzed services and their operations.Source quoteL18: Our preliminary results demonstrate the significant advantage of our approach over existing tools. Compared to NLP2REST without the validation module, our method improves precision from 50% to 97%. Even when compared to NLP2REST equipped with its validation module, our approach still increases precision from 79% to 97%. Additionally, RESTGPT successfully generates both syntactically and semantically valid inputs for 73% of the parameters over the analyzed services and their operations, a considerable improvement over ARTE, which could generate valid inputs for 17% of the parameters only. Given these encouraging results, we outline a number of research directions for leveraging LLMs in other ways for further enhancing REST API testing. |
| Analyzed services and their operations | ARTE | parameters for which valid inputs were generated | 17% | Compared with RESTGPT's parameter value-generation result; the validity criteria for AR…Source quoteL18: Our preliminary results demonstrate the significant advantage of our approach over existing tools. Compared to NLP2REST without the validation module, our method improves precision from 50% to 97%. Even when compared to NLP2REST equipped with its validation module, our approach still increases precision from 79% to 97%. Additionally, RESTGPT successfully generates both syntactically and semantically valid inputs for 73% of the parameters over the analyzed services and their operations, a considerable improvement over ARTE, which could generate valid inputs for 17% of the parameters only. Given these encouraging results, we outline a number of research directions for leveraging LLMs in other ways for further enhancing REST API testing. |
BibTeX
@misc{kim2023leveraging,
author = {Myeongsoo Kim and Tyler Stennett and Dhruv Shah and Saurabh Sinha and Alessandro Orso},
title = {{Leveraging Large Language Models to Improve REST API Testing}},
year = {2023},
eprint = {2312.00894},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2312.00894},
}Ask Althea to put this paper to the test.
Loading related content...