Can you help me with item - Verify Element Property Value?
In the new project, I created a test case with a POST request for a web service:
{
“request”:[
{
“Period”:“2018-06-11T16:11:20.0904778Z”,
“ExternalContactId”: “854”,
“Plan”: “15”
}
]
}
In the program Katalon, he does a good job.
Then I wrote a code that Katalon would output the response from the web service to which the request was sent:
def responseData = WS.sendRequest(findTestObject(‘1 POST from EditManagerPlanInfo Method’))
responseCode = responseData.getStatusCode()
println('Response Code: ’ + responseCode)
// response body
def responseText = responseData.getResponseText()
println('Response Text: ’ + responseText)
def jsonObject = new groovy.json.JsonSlurper().parseText(responseText)
// extract value from response body
// get origin attribute
def ip = jsonObject.origin
WS.verifyElementPropertyValue(responseData, ‘Key’, ‘11399’)
But, the test case is dumped with an error:
03-13-2018 11:52:32 AM - [FAILED] - Expected element property value ‘11399’ is not equal with actual property value ‘null’
03-13-2018 11:52:32 AM - [FAILED] - Unable to verify element property value (Root cause: Expected element property value ‘11399’ is not equal with actual property value ‘null’)
03-13-2018 11:52:32 AM - [END] - End action : verifyElementPropertyValue
03-13-2018 11:52:32 AM - [FAILED] - Test Cases/Dashboard - 1) Method FAILED because (of) Unable to verify element property value (Root cause: Expected element property value ‘11399’ is not equal with actual property value ‘null’)
03-13-2018 11:52:32 AM - [END] - End Test Case : Test Cases/Dashboard - 1) Method
Thus in the output text (responseText) there is a line with data, necessary to me:
03-13-2018 11:52:32 AM - [START] - Start action : Statement - println("Response Text: " + responseText)
Response Text: {“EditManagerPlanInfoResult”:{“Result”:1,“ResultCodeDescription”:[{“Description”:“Неверный формат даты поля [EndDate]”,“ExternalContactId”:“854”,“Key”:“11399”,“Period”:“2018-06-11T16:11:20.0904778Z”},{“Description”:“Контакт с таким [ExternalContactId] не существует. Не найден Контакт [Contact] с внешним идентификатором [ExternalId] = 854”,“ExternalContactId”:“854”,“Key”:“11301”,“Period”:“2018-06-11T16:11:20.0904778Z”}]}}
Can you help with this problem?
Becouse there is string “Key”:“11399” from response at WS.
Thanks!