The actions written in ‘Verification’ tab of an API request from Katalon are not working.
It is not showing any logger message written and not getting key values from API response.
Nothing is showing after API request execution.
I have used below statement in ‘Verification’ tab, which should be executed after a Send request.
println (“value is**”+amtValue)
KeywordLogger log = new KeywordLogger()
log.logInfo("output is "+amtValue)
Please help me to overcome this issue.
Thanks in advance,
Do you choose “Test Request And Verify” option? The verification script is only executed when you choose this option. Please refer to https://docs.katalon.com/katalon-studio/docs/verify-api-responses.html#run-tests-with-generated-verification-statements for more details.
Thank you so much for your help.
Actually I was using that option in web service request directly but I wanted it from test cases. in Test cases I was using ‘send request’ option only. now i have changed that option to ‘Send request and verify’. I am able to get the validations now.
Thankyou once again.
How to get an element property value from an API response?
There is keyword ‘verifyElementPropertyValue’ which verifies an element property value with an expected value. But I want to get an element property value from an API response, save it in a variable and later compare this with a UI value.
Please let me know is there any keyword available to get an element property value.
@ravi.b23 use JsonSlurper to parse the response in a groovy collection and further extract any key/value from it and use it at taste
(search the forum and the docs on how to parse the api response and you will find plenty working examples)
This is an example code to get the response data.
response = WS.sendRequest(findTestObject(‘Employees/Login backoffice and get access token’))
JsonSlurper slurper = new JsonSlurper()
Map parsedJson = slurper.parseText(response.getResponseText())
String access_token = parsedJson.access_token
GlobalVariable.Token = access_token