In this article, I will cover how to perform API Testing using Katalon Studio and how to assert the various responses.
API Testing- New version of Katalon support API testing (SOAP and RestFul both) and they also provided very easy UI which will help testers to automate API’s without using much coding knowledge as well.
In one of my previous article, we already discussed how to download and use Katalon Studio for Web Automation so if you have not checked yet then I will suggest you go through the first post for Web UI automation.
API Testing using Katalon Studio
Quick notes before we start the post.
If you have not download Katalon then first go and download the new version of Katalon 5.4.2 Link to Download
I will be using sample application for API Testing
http://jsonplaceholder.typicode.com/
http://jsonplaceholder.typicode.com/posts
How to perform Get Operation in Katalon Studio
How to Post and Delete Operation in Katalon Studio
Introduction to Katalon Analytics
Step 1- Create a new project in Katalon Studio
2- Provide a meaningful name to your project
3- Create a new web service request
4- Katalon support SOAP and Rest both, so in this article, we are using only Rest API.
5- Create an Object type
Enter the URL of the API which you want to test and click on run button. It will take few seconds and will provide result in right panel which will have status, size and time taken by the server to respond.
You can also view the result in different forms like raw type and so on.
6- Create Test Case
Testcase is series of steps which you want to perform. A single test case can have multiple steps and multiple validations depends on requirement.
7- Create steps for testing
Katalon already added many keywords which will help you perform different steps and validation. We are using a couple of keywords like SendRequest and VerifyResponseCode keywords.
Here is the list of keywords and documentation of API testing keywords for Katalon
We are using SendRequest keyword which accepts Test Object (VerifyGet) and output (optional) which will store the result.
Select Object type and click on ok button.
Kindly provide the variable name (myresp in our case) which we will use for validation.
Let’s add another keyword Verify Response Status code keyword which will validate the response code.
Get the response variable and provide input as the response variable and expected the result. If response code will match then it will pass the test else failed.
8- Run the test and analyze the result
Hope you have like above article. If yes then please share this post with your friends as well.
See you in the next article 🙂 Have a nice day.
Raj says
While doing POST methods in RESTful API, the JSESSIONID gets changed for different POST methods. Only I could success message for the first POST method and for rest of the POST methods it gets failed.
Mukesh Otwani says
Hi Raj,
Please check whether you are able to do POST call with same payload or different payload.