RESTful API Automated Test Case Generation with EvoMaster

Author:

Arcuri Andrea1

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)

Subject

Software

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篇论文的施引文献,订阅后可以查看论文全部施引文献

1. DynER: Optimized Test Case Generation for Representational State Transfer (REST)ful Application Programming Interface (API) Fuzzers Guided by Dynamic Error Responses;Electronics;2024-09-01

2. Combining Neuroevolution with the Search for Novelty to Improve the Generation of Test Inputs for Games;Proceedings of the 1st ACM International Workshop on Foundations of Applied Software Engineering for Games;2024-07-16

3. Evolutionary Generative Fuzzing for Differential Testing of the Kotlin Compiler;Companion Proceedings of the 32nd ACM International Conference on the Foundations of Software Engineering;2024-07-10

4. Exploring behaviours of RESTful APIs in an industrial setting;Software Quality Journal;2024-07-03

5. Evaluating Search-Based Software Microbenchmark Prioritization;IEEE Transactions on Software Engineering;2024-07

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3