Affiliation:
1. Kristiania University College, Norway and University of Luxembourg, Luxembourg
Abstract
RESTful APIs are widespread in industry, especially in enterprise applications developed with a microservice architecture. A RESTful web service will provide data via an API over the network using HTTP, possibly interacting with databases and other web services. Testing a RESTful API poses challenges, because inputs/outputs are sequences of HTTP requests/responses to a remote server. Many approaches in the literature do black-box testing, because often the tested API is a remote service whose code is not available. In this article, we consider testing from the point of view of the developers, who have full access to the code that they are writing. Therefore, we propose a fully automated white-box testing approach, where test cases are automatically generated using an evolutionary algorithm. Tests are rewarded based on code coverage and fault-finding metrics. However, REST is not a protocol but rather a set of guidelines on how to design resources accessed over HTTP endpoints. For example, there are guidelines on how related resources should be structured with hierarchical URIs and how the different HTTP verbs should be used to represent well-defined actions on those resources. Test-case generation for RESTful APIs that only rely on white-box information of the source code might not be able to identify how to create prerequisite resources needed before being able to test some of the REST endpoints. Smart sampling techniques that exploit the knowledge of best practices in RESTful API design are needed to generate tests with predefined structures to speed up the search. We implemented our technique in a tool called E
vo
M
aster
, which is open source. Experiments on five open-source, yet non-trivial, RESTful services show that our novel technique automatically found 80 real bugs in those applications. However, obtained code coverage is lower than the one achieved by the manually written test suites already existing in those services. Research directions on how to further improve such an approach are therefore discussed, such as the handling of SQL databases.
Funder
Research Council of Norway
European Research Council (ERC) under the European Union's Horizon 2020 research and innovation programme
Publisher
Association for Computing Machinery (ACM)
Reference52 articles.
1. A Systematic Review of the Application and Empirical Investigation of Search-Based Test Case Generation
2. Subbu Allamaraju. 2010. Restful Web Services Cookbook: Solutions for Improving Scalability and Simplicity. O’Reilly Media Inc. Subbu Allamaraju. 2010. Restful Web Services Cookbook: Solutions for Improving Scalability and Simplicity. O’Reilly Media Inc.
3. Many Independent Objective (MIO) Algorithm for Test Suite Generation
4. RESTful API Automated Test Case Generation
Cited by
133 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献