arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1901.01538cs.SE
收藏

REST风格的API测试用例自动生成

RESTful API Automated Test Case Generation

Andrea Arcuri

摘要:

如今,Web服务在企业应用程序的开发中发挥着重要作用。许多这样的应用程序现在都是使用面向服务的架构(SOA)开发的,其中微服务是最受欢迎的类型之一。RESTful Web服务将通过使用HTTP的网络上的API提供数据,可能与数据库和其他Web服务进行交互。测试RESTful API带来了挑战,因为输入/输出是对远程服务器的HTTP请求/响应序列。文献中的许多方法都进行了黑盒测试,因为测试的API是一个远程服务,其代码不可用。在本文中,我们从开发人员的角度考虑测试,他们确实可以完全访问他们正在编写的代码。因此,我们提出了一个完全自动化的白盒测试方法,测试用例自动生成使用进化算法。测试是基于代码覆盖率和故障发现度量的奖励。我们在一个名为EVOMASTER的工具中实现了我们的技术,它是开源的。在两个开源的,但不平凡的RESTful服务和一个工业服务上的实验确实表明,我们的新技术确实在这些应用程序中自动找到了38个真正的错误。然而,所获得的代码覆盖率低于那些服务中已经存在的手动编写的测试套件所实现的覆盖率。因此,如何进一步改善这种方法的研究方向进行了讨论。

英文摘要:

Nowadays, web services play a major role in the development of enterprise applications. Many such applications are now developed using a service-oriented architecture (SOA), where microservices is one of its most popular kind. 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, as inputs/outputs are sequences of HTTP requests/responses to a remote server. Many approaches in the literature do black-box testing, as the tested API is a remote service whose code is not available. In this paper, we consider testing from the point of view of the developers, which do 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. We implemented our technique in a tool called EVOMASTER, which is open-source. Experiments on two open-source, yet non-trivial RESTful services and an industrial one, do show that our novel technique did automatically find 38 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 approach are therefore discussed.

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

↑