Skip to main content

Using Web Services in a test case in Katalon Studio

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.

In test request object view

You can add Web Services request to test case directly from the test request object view. Click on the plus icon to add Web Services request to a new test case or any existing test case.

add web service object

In the manual view of the test case editor

Follow the steps below to use web service object in Manual view:

  1. Open a test case in Manual view, then select the option to Add Web Service Keyword from command toolbar.

    add web service keyword

  2. A Web Service step is added to the test case.

    To send a request to Web Service, you need to use Send Request keyword. Select the Send Request keyword now.

    send request

  3. 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.

  4. The output of Send Request keyword could be validated if needed using different Verify... keywords depending on your situation. To learn more about Web Service keywords, you can refer to the following documents:

In the script view of a test case 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([]))
//Verify if a value at a specific location in response is as expected
WS.verifyElementPropertyValue(response, <Element Locator>, <expected value>)

For example:

add web service in a test script

If you have used variables and parameters in test requests, you can pass values to the variables as follows:

//Send a test request and pass values to variables used in that request
def response = WS.sendRequest(findTestObject([the ID of Web Service object], ["variable1": value1, "variable2": value2, ... , "variableN": valueN]))

For example:

The following API docs might be 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