Do you think IIT Guwahati certified course can help you in your career?
No
Introduction👨✈
When dealing with APIs in "ReadyAPI", you must ensure that the APIs you are importing are per the company's standards. But the question is how to validate or verify APIs in ReadyAPI. Okay! The answer is we can validate APIs with the "WS-I Inference tool". Cool! Are you wondering how to do it? Fine! Are you ready❓
So let us learn about verifying APIs in ReadyAPI.💫
Verifying APIs in ReadyAPI✅
Before you validate your APIs with the "WS-I Inference tool" and compare requests with the schema, you need to know how to infer a schema for a web service.
Inferring REST Schemas📋
The "REST Schema" inference is a way of creating the schema for a service. You can use this way when the schema is not provided in the service definition or if it is outdated. Here in this topic, you learn how you can infer a schema for a web service.
Sample Request⚙️
We will use a demo response from the "Flickr REST example" service in this sample request to see how ReadyAPI uses schemas. Check the given below URL ➡️
4️⃣ReadyAPI will suggest adding assertions to the test. You will not need them, so you can uncheck them and click "Next".
5️⃣"ReadyAPI" will offer you to run the test or create a data-driven test. You do not need either option. Close the dialogue.
Note ⚠️- "ReadyAPI" creates the project with the "Flickr API". You can find it in the navigator.
Get Response🏂🏻
The request is now available in "ReadyAPI".
1️⃣ To find the request, click on the plus icon to expand all project items.
2️⃣Double-click on the request.
"ReadyAPI" will display the parameters in the "Request" section.
3️⃣The request has all the parameters defined in the URL. You will see the empty "Response" section if you haven't sent the request yet.
4️⃣Now, click on the green play button icon to get the response from the server.
Response -
Creating a Schema🧙🏻
The "Schema" panel shows the detected schema conflicts.
The response analysis shows conflicts between the current response and the previously inferred schema. In this case, this is typically because no prior schema exists.
Follow the given below steps to create a schema manually -
1️⃣Remove the selection from the "Auto-Resolve" check box.
2️⃣Click "Resolve Conflicts" in the "Schema" panel to resolve the conflicts manually.
3️⃣For each detected conflict, you will get a notification and can take necessary actions.
4️⃣We can resolve all conflicts at once because there is no previous schema. Click "Yes to all".
5️⃣"ReadyAPI" resolves all conflicts and adds them to the "Schema" panel.
6️⃣After "ReadyAPI" resolves all conflicts, it adds the schema to the schema's tab.
Adding More Requests to Schema➕
You need to send a different request to add more definitions to the schema. You may use the "Auto-Resolve" option as we can assume the responses to be valid.
1️⃣Open the "Conflicts" tab and select the "Auto-Resolve" option.
2️⃣To get a different response, remove the api_key parameter value from the request.
3️⃣Now, click on the green play button icon.
4️⃣The response will contain an error.
5️⃣"ReadyAPI" resolves and logs errors automatically.
6️⃣When all conflicts are resolved, the new response will appear in the schema.
Here is the comparison between the resources -
You can modify the request to get more different responses and create a more complex schema.
Use the Schema🧤
The primary purpose of inferred schemas is to verify that the service response contains no unexpected elements. Use the "Schema Compliance" assertion for this ➡️
1️⃣Expand the "Assertions" panel and click on the plus icon.
2️⃣Select Compliance, Status, and Standards, then "Schema Compliance", and click on "Add".
"ReadyAPI" adds the assertion and automatically verifies the incoming responses.
Tip 💡- The schema is also displayed on the specification page of the API editor. Click on the reload icon if the schema is not displayed to reload the definition.
Fine! So far, we have learnt about inferring REST schemas. Let us see the second part of our article on verifying APIs in ReadyAPI. And learn about SOAP WS-I Compliance.
SOAP WS-I Compliance📋
ReadyAPI has integrated support for the WS-I organisation "Basic Profile" validation tool.
This tool is available when you select the interface in the navigator.
The "WS-I Compliance tool" settings are available on the WS-I setting page in "Preferences". Or click on the setting icon to access the configuration settings.
Validating WSDL Definitions🕶
To run the WS-I compliance tool for a WSDL definition -
1️⃣Open the "SOAP" interface from the navigator.
2️⃣Switch to the "WSI-Compliance page".
3️⃣Now, click on the green play button icon to create a WS-I report for this interface.
Or, in the navigator, right-click on the SOAP interface and select "Check WSI Compliance" to run the WS-I Test Tools and validate the "WSDL" definition.
Validating SOAP Requests and Responses👓
To validate a request or response:
1️⃣Open a request or response in the "Request Editor".
2️⃣Right-click on the request or response and select "Validate".
We hope you understood about verifying APIs in ReadyAPI. Wait! Do you still have doubts? Keep going.
Frequently Asked Questions
What is "ReadyAPI"?
"ReadyAPI" is one of the products of "SmartBear". It is an easy-to-use no-code API testing platform designed to streamline the testing workflows.
Is "ReadyAPI" open source?
"ReadyAPI" includes third-party open-source software modules subject to their respective licenses.
What is "SmartBear"?
"SmartBear" software is an American privately-held IT company that delivers tools for APM(application performance monitoring), software development and testing, API testing and management.
What does API stand for?
API stands for Application Programming Interface.
What is the use of API?
API is a software intermediary that allows two different applications to communicate.
Conclusion
In this article, we discussed verifying APIs in ReadyAPI. We learnt to validate our APIs with the "WS-I Inference tool" and compare requests with the schema.
We hope this blog on verifying APIs in ReadyAPI was helpful. You can refer to other similar articles as well -