Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Katalon Studio now supports the ability to write verification scripts directly in Web Service object's details. This support will greatly reduce the time for you of going back and forth between the test case and request object to add test scripts and verify response on the fly. Verify the response can be done instaneously.

Verification snippets can be accessed by clicking on the 'Verification' tab within Web Service object's view.

Image Removed

 

 

List of Available Verification Snippets

On the right panel of 'Verification' tab is the list of common pre-built snippets which can assist you in most of the verification cases. 

SnippetDescriptionGet current responseReturn response object after sending a request successfully.Get a global variableReturn a Global Variable's value.Response body: Contains stringVerify if response's body contains a specific string.Response body: Convert to JSON ObjectConvert response's body to JSON.Response headers: Content-Type headerVerify Content-Type header's value.Status code: Code is 200Verify if response's status code is 200 or no.Status code: Successfully requestVerify if the request is sent successfullyResponse body: number of elementsVerify number of elements from responseResponse body: element not emptyVerify specified element is not emptyResponse: Array containsVerify specified arrays contain valuesResponse: Get single info of array list Get single info of array list

Image Added

Using Verification Snippets

When you click on one of these labels, it the available snippets, Katalon Studio will generate a snippet for you. 

Info

The generated snippet is ONLY an example. DON'T try to use them immediately without adjustments matched your needs, otherwise it will not work.

Using Verification Snippets

Once the verification snippets are generated, you can use it in either in your current Web Service's object or in your Test Case

  • In Web Service's object: Click on drop-down button next to 'Play' button in Web Service object's details and select 'Test Request and Verify'. 
    Image Modified

    It will send the current request and also execute verification snippets. Verification logs executed using verification snippets will be displayed on 'Verification Log' tab. If you don't want to send a test request using current verification snippets, then just click on 'Play'
button
  •  button.
Image Removed
  • Image Added
  • In test case:  Use 'Send Request and Verify' keyword. This will also send the current request and execute verification snippets. 

    Code Block
    languagegroovy
    themeRDark
    WS.sendRequestAndVerify(findTestObject('REST_CommentDetails'))

    Execution results will be displayed in 'Log Viewer' tab.

    Image Modified

List of Available Verification Snippets

On the right panel of 'Verification' tab is the list of common pre-built snippets which can assist you in most of the verification cases. 

SnippetDescriptionAvailable Since
Get current responseReturn response object after sending a request successfully.5.5
Get a global variableReturn a Global Variable's value.
Get a variableReturn the value of a variable that you've created in the Web Service Test Object.5.7
Response body: Contains stringVerify if response's body contains a specific string.5.5
Response body: Convert to JSON ObjectConvert response's body to JSON.
Response headers: Content-Type headerVerify Content-Type header's value.
Status code: Code is 200Verify if response's status code is 200 or no.
Status code: Successfully requestVerify if the request is sent successfully
Response body: number of elementsVerify number of elements from response
Response body: element not emptyVerify specified element is not empty
Response: Array containsVerify specified arrays contain values
Response: Get single info of array listGet single info of array list

Table of Contents
classkat_toc