Using Web Services in a Test Case
Estimated reading time: 2 minutes
Katalon Studio supports various ways to use a Web Service object in a test case. You can call the web service methods from Manual View (keywords test), Script View (test scripts), and verify the responses. Calling or adding web service object is easy in Katalon Studio.
Instantly in Web Services Object View
You can add Web Services request to test case directly from the object details view. Simply click on the plus icon to add to New or any Existing test case.
Follow the steps below to use web service object in Manual view:
Open a test case in Manual view, then select the option to add a Web Service Keyword from command toolbar.
Double click on object cell to specify the web service object to Send Request.
Variables for Web Service Test Object
When you modify the variables of a Web Service Test Object in a test case, the values will ONLY apply to that particular test case. If you reuse that Test Object in another test case, Katalon Studio will get the original values that were defined in the Test Object editor.
You can use the Send Request keyword for Web Service object and the Verify… keywords to verify the web service response. You may want to refer to Handle Response messages for more details regarding Element Locator:
//Send a SOAP request and returns its response def response = WS.sendRequest(findTestObject([the ID of Web Service object])) //Verify if a value at a specific location in response is as expected WS.verifyElementPropertyValue(response, <Element Locator>, <expected value>)
The following API docs may prove useful when working with web service objects:
|Request Object||Describe all available methods for Request Object|
|Response Object||Describe all available methods for Response Object|