Automated testing of OpenAPI described RESTful microservices utilizing open source tools
Surprisingly, even though RESTful microservices are everywhere nowadays, open source tools for automated testing of such hardly exist.
How about tools which can consume the OpenAPI (Swagger) description of REST APIs and generate tests, including test data, based on this information? Such automated testing nirvana truly exists!
In this purely practical presentation, based on a recent deployment on a commercial project for my current client, Data In Motion Consulting GmbH https://www.datainmotion.de/" , I will show you how to implement an always in-sync, fully automated OpenAPI-described RESTful microservices testing solution with freely available open-source tools, including:
automated generation of REST API smoke test scripts,
utilizing the OpenAPI (Swagger) spec and the K6 (https://k6.io/)
OpenAPI generator (https://openapi-generator.tech/) automated extraction of test data from examples specified in the OpenAPI (Swagger) spec,
for a self-contained, ready-to-run REST API test script adding new K6 OpenAPI generator test generation template for automated generation of REST API load tests, in addition to REST API smoke tests
adding support for automated OAuth 2.0 authentication of REST API calls
integrating into Jenkins CI/CD pipeline the automated generation of REST API tests as well as automated testing of REST APIs via generated test scripts
As you will see, the benefits of describing RESTful microservices with OpenAPI (Swagger) go way beyond living documentation. With freely available open-source tools, your REST APIs can all be tested now automatically. What’s most important, being automatically generated from the OpenAPI description of REST APIs, the test scripts themselves can now always be kept up-to-date with the latest version of your REST APIs.