Download presentation
Presentation is loading. Please wait.
1
Testing RESTful Web APIs
Prepared by Antanas Bareikis
2
Contents Overview Swagger Assertible Demo Sources 2017-12-20
VU, Matematikos ir Informatikos fakultetas
3
Overview REST stands for Representational State Transfer. It is a software architecture style that relies on a stateless communications protocol, most commonly, HTTP. REST structures data in XML, YAML, or any other format that is machine-readable, but usually JSON is most widely used. VU, Matematikos ir Informatikos fakultetas
4
Swagger “Swagger is a simple yet powerful representation of your RESTful API. (...) With a Swagger-enabled API, you get interactive documentation, client SDK generation and discoverability.” - swagger.io Swagger is a formal specification surrounded by a large ecosystem of tools, which includes everything from front-end user interfaces, low-level code libraries and commercial API management solutions. VU, Matematikos ir Informatikos fakultetas
5
Swagger UI Swagger UI is an open source tool which automaticaly generates a web page from swagger specification. Allows developers or end consumers to visualize and interact with the API‘s resources without having any of the implementation logic in place. Swagger UI is an open source tool which generates a web page. This web page documents the Restful APIs generated by Swagger specification. This UI presentation of APIs is user friendly, easy to understand with all the complexity of business logic kept behind the screen. This is a great tool for developers, testers and end consumers, to understand the end points. It also allows you to manually test these APIs from this web page. Please see below the sample screenshot of how the UI looks. Swagger UI allows anyone — be it your development team or your end consumers — to visualize and interact with the API’s resources without having any of the implementation logic in place. It’s automatically generated from your Swagger specification VU, Matematikos ir Informatikos fakultetas
6
Swagger UI 2017-12-20 VU, Matematikos ir Informatikos fakultetas
This UI presentation of APIs is user friendly, easy to understand with all the complexity of business logic kept behind the screen. This is a great tool for developers, testers and end consumers, to understand the end points. It also allows you to manually test these APIs from this web page. The Swagger UI is automatically generated from any API defined in the Swagger specification, and can be viewed within a browser. Swagger UI can be used as is provided by Swagger. Or we can make changes as per the needs and make our own build. VU, Matematikos ir Informatikos fakultetas
7
Testing the APIs manualy
Access through: Swagger UI provides a rich user friendly interface with all the details of API. These details include the request parameters with its type (path, query, body, etc.), its data type (string, array[string], HttpSession, schema of body type parameter, etc.) and whether it’s a mandatory parameter or not. These details also include the response type (application/json, etc.) and schema of response body. Since we have already configured the Swagger UI into our project, let’s go to the below URL and have a look. In the UI, we can see all the controllers listed. VU, Matematikos ir Informatikos fakultetas
8
Testing the APIs manualy (2)
Once you click on one of those controllers, you will get to see a list of all the APIs implemented in that controller with its URL like this. VU, Matematikos ir Informatikos fakultetas
9
Testing the APIs manualy (3)
Clicking it will show us the details of that API along with the fields to enter values for request parameters. If API has default value for any of the parameter, the field will come preset with the value. VU, Matematikos ir Informatikos fakultetas
10
Testing the APIs manualy (4)
Hit Try it out to make a request to that API. The response of this request can be checked to match the expectation from an API. VU, Matematikos ir Informatikos fakultetas
11
Swagger UI Extensions API Fortress Restlet Client Rest Secured
Assertible Swagger test templates 1. It is an automated testing platform that monitors the performance of APIs, validates the accuracy of the entire payload, and provides real-time insights without any coding. You get a listing of all the available API endpoints. Choose an API you want to test, and it creates a test for you. You can modify the test as per your need and publish. You can run a test manually, or schedule it to run autonomously, and get notified of issues as soon as they happen. The test will generate a detailed report where execution is captured in steps. These details makes the analysis much easier to find the cause of failure when needed. 2. Restlet Client (known as DHC earlier) enables you to interact with REST services. This client improves the user experience, saves time to debug the REST calls & sharing of requests with others is made convenient. Swagger can be used as an extension for this client. When integrated, it provides Swagger document in JSON format. Swagger UI also provides its support to Restlet APIs, makes it easy to interact and test the APIs. VU, Matematikos ir Informatikos fakultetas
12
Demo VU, Matematikos ir Informatikos fakultetas
13
Conclusions Using auto-generated Swagger UI makes manual testing of API quicker and easier. It‘s possible to use various extensions for swagger UI like Assertable which provide automated testing and monitoring capabilities. VU, Matematikos ir Informatikos fakultetas
14
Sources https://www.soapui.org/rest-testing/getting-started.html
VU, Matematikos ir Informatikos fakultetas
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.