Question About VerifyElementPropertyValue

Hi,

I followed a training video on how to setup an API test (video was from ver 5.4 & current ver is 7.2) for a simple Sign In API (GET). The test is failing and I have several questions. My test has the following steps:

  • Send Request
  • Verify Response Status Code
  • Verify Element Property Value

The Response returned from the API is this
{
“tokenValidityTime”: “300”,
“signInStatus”: “LoginSuccessfull”,
“accounts”: [
{
“accNumber”: “6000112216066021”,
“balance”: “0”,
“routingNumber”: “122106316”
}
],
“profileInformation”: {
“first_name”: “Apple”,
“last_name”: “Test”,
“sysDate”: “2020-01-30T15:46:40.969Z”
}
}

  1. Using the “Verify Element Property Value” in the test. I noticed that ver 5.4 had the “Value” field of the Param Type is set as “String” but in ver 7.2 the “Value” field of the Param Type is set as “Object” - would that make a difference?

  2. I used the JSON Path Finder tool to retrieve the path for the “acctNumber” value, it was returned as “.accounts[0].accNumber” so the “Input” field for the key word is set up as follows:

  • Param Name = response; Param Type = ResponseObject; Value Type = Variable; Value = response
  • Param Name = locator; Param Type = String; Value Type = String; Value = “.accounts[0].accNumber”
  • Param Name = value; Param Type = Object; Value Type = String; Value = “6000112216066021”

The test steps of Send Request and Verify Response Status Code pass but the last step FAILS with the following error message:
Test Cases/SignIn/Sign In FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to verify element property value (Root cause: groovy.lang.MissingPropertyException: No such property: signInStatus for class: Script1
at Script1.run(Script1.groovy:1)
at com.kms.katalon.core.webservice.helper.WebServiceCommonHelper.parseAndGetPropertyValueForJson(WebServiceCommonHelper.java:162)
at com.kms.katalon.core.webservice.keyword.builtin.VerifyElementPropertyValueKeyword$_verifyElementPropertyValue_closure1.doCall(VerifyElementPropertyValueKeyword.groovy:52)
at com.kms.katalon.core.webservice.keyword.builtin.VerifyElementPropertyValueKeyword$_verifyElementPropertyValue_closure1.call(VerifyElementPropertyValueKeyword.groovy)
at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:68)
at com.kms.katalon.core.webservice.keyword.builtin.VerifyElementPropertyValueKeyword.verifyElementPropertyValue(VerifyElementPropertyValueKeyword.groovy:48)
at com.kms.katalon.core.webservice.keyword.builtin.VerifyElementPropertyValueKeyword.execute(VerifyElementPropertyValueKeyword.groovy:43)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:72)
at com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords.verifyElementPropertyValue(WSBuiltInKeywords.groovy:189)
at com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords$verifyElementPropertyValue$1.call(Unknown Source)
at Sign In.run(Sign In:23)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1580404651155.run(TempTestCase1580404651155.groovy:23)
)
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:50)
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy)
at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:70)
at com.kms.katalon.core.webservice.keyword.builtin.VerifyElementPropertyValueKeyword.verifyElementPropertyValue(VerifyElementPropertyValueKeyword.groovy:48)
at com.kms.katalon.core.webservice.keyword.builtin.VerifyElementPropertyValueKeyword.execute(VerifyElementPropertyValueKeyword.groovy:43)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:72)
at com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords.verifyElementPropertyValue(WSBuiltInKeywords.groovy:189)
at com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords$verifyElementPropertyValue$1.call(Unknown Source)
at Sign In.run(Sign In:23)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1580404651155.run(TempTestCase1580404651155.groovy:23)
Caused by: groovy.lang.MissingPropertyException: No such property: signInStatus for class: Script1
at Script1.run(Script1.groovy:1)
at com.kms.katalon.core.webservice.helper.WebServiceCommonHelper.parseAndGetPropertyValueForJson(WebServiceCommonHelper.java:162)
at com.kms.katalon.core.webservice.keyword.builtin.VerifyElementPropertyValueKeyword$_verifyElementPropertyValue_closure1.doCall(VerifyElementPropertyValueKeyword.groovy:52)
at com.kms.katalon.core.webservice.keyword.builtin.VerifyElementPropertyValueKeyword$_verifyElementPropertyValue_closure1.call(VerifyElementPropertyValueKeyword.groovy)
at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:68)
… 17 more

What am I doing WRONG???

hi,

are you checked this page

Uh??? don’t understand your answer

hello,

you have issue here “Unable to verify element property value”

Of course I did and several other pages as well…but none of the examples addressed the issue. That is why I reached out here…

I know and I am waiting on a response to my problem…

hello,

are you using JsonSlurper to parse json result? like

def json = new JsonSlurper().parseText('{"applications":[{"name":"test123","id":"c1257c5","description":"test","type":"generic","version":"0.1"},{"name":"Asset_1","id":"a9e0bce","description":"sfsdgdg","type":"generic","version":"0.1"},{"name":"Asset_2","id":"a9e0cd2","description":"sffgdgf","type":"generic","version":"0.1"}]}')
println("***DEBUG**** "+json.applications[1].id)

DEBUG* a9e0bce

This is the root of the problem. It looks like, in your script, you are trying to reference a variable signInStatus that has not been defined (that’s generally what a MissingPropertyException indicates). Can you share your test script?

What is a Json parser and why would I need that???

Please read thru my question, I laid out ALL the details there. It is a very simple question. I am attempting to evaluate this tool using a very simple test that is failing thru your tool. I followed ALL the videos and documentation and can not find any answers to why it would fail

hello you,

hard to find out what is problem if you are not provided your script that’s why I am providing questions and some suggestions :slight_smile:

Thank YOU Brandon

This is the real script I am trying to run - I am trying to verify the elements in the “accounts” portion of the response

here is the response:
“token” : ewrerydjgkfgijrtupk,nyouktu
“tokenValidityTime”: “300”,
“signInStatus”: “LoginSuccessfull”,
“accounts”: [
{
“accNumber”: “6000112216066021”,
“balance”: “0”,
“routingNumber”: “122106316”
}
],
“profileInformation”: {
“first_name”: “Apple”,
“last_name”: “Test”,
“sysDate”: “2020-01-30T15:46:40.969Z”
}
}

And here is my script:

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows
import internal.GlobalVariable as GlobalVariable

def resObj = WS.sendRequest(findTestObject(‘Sign In/Sign-in-API’, [(‘username’) : ‘8881110030’, (‘password’) : ‘Test-1234’
, (‘identifier_for_vendor’) : ‘1234566789’]))

WS.verifyResponseStatusCode(resObj, 200)

WS.verifyElementPropertyValue(resObj, ‘.accounts[0].accNumber’, ‘6000112216066021’

hello you,

WS.verifyElementPropertyValue(resObj, ‘.accounts[0].accNumber’, ‘6000112216066021
parenthesis missing )

Its there, I just didn’t cut & paste it correctly

didn’t seem to get full last line when I pasted it in

WS.verifyElementPropertyValue(resObj, ‘.accounts[0].accNumber’, ‘6000112216066021’)

Hmmmm, well the first thing I notice is that your response JSON is… malformed? If you take what you’ve pasted and place it in any JSON validator (here’s an online one), it is definitely invalid. Just looking at it:

1.) “token” : ewrerydjgkfgijrtupk,nyouktu <- the comma in the value is a problem
2.) It looks like there’s an extra closing brace at the end.

Are you in control of the JSON response that is being returned? Is it a mock service? Is it just a copy/paste error?

hello you,

are you able to send request too?

Here is the correct one - and I am using the JSON Path Finder tool (as I mentioned in my original post) and the JSON is correct as it is currently working in our app and thru Postman & SOAPUI

{
“token”: “eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6Ilg1ZVhrNHh5b2pORnVtMWtsMll0djhkbE5QNC1jNTdkTzZRR1RWQndhTmsifQ.eyJpc3MiOiJodHRwczovL2thcnJpa2luaXRtLmIyY2xvZ2luLmNvbS8yYzcwZDA1NC1mMzA5LTQxMDctOWZhOC04NDQ2NDc3NjQ3NGQ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lXJ_OspHIC6EvvuAyHhmI7DjcW7QUn3d2J2DtzzWu-8cpaczp7EX8LrVgNbppMVU0erJQRdaUKiKvodeSOpfHs_sOW4CuMhfI0gSDpbJNwRAyt3zU73Yigmk0uzM9f9kh7MRMfpkLmaavB3FrqoLCHZhB3FaPNg3yxosPfEtLfYnlT7ishw96kzSegL-39D–qnRTQ9orO6upuF6W38xuKGmZKGq3eNc0aNoXUaPU-ujRCNroF9dVvwgS5kp_pCKYY646vAnWQ_tGGp3oxTgj7dR3RVOWiUjPaxidnziY7ShZLw89Llu7k4QFSLEO9nuY-vKCEw-8_dPwdrf7OY5D5itzA8fSyJjHYl0AnFKLJtDANXoxcR80tGtb90Y-_BUofXF8i8wKSLPfLrTYzJRiZBGNM9RGVLf3TcMfkho-vuf0Ur6fV8btxalKMGL-fCudNjD5_FD05OEXjBg9cxGkvqYvskB1PompB8gL4E3hCDdvyeQ-zMd7X6rh5eIVICdeiqjIT0Q-AsBgHyXM0Ny3uMMRD4zWvMcjSxAUUPXe0LBNwZo.jkoLvQGGAUDthGwDnIO60Q”,
“tokenValidityTime”: “300”,
“signInStatus”: “LoginSuccessfull”,
“accounts”: [
{
“accNumber”: “6000112216066021”,
“balance”: “0”,
“routingNumber”: “122106316”
}
],
“profileInformation”: {
“first_name”: “Apple”,
“last_name”: “Test”,
“sysDate”: “2020-01-30T15:46:40.969Z”
}
}

(FYI, you don’t need to post twice, we can all see it :wink:)

sorry…didn’t know you could see all responses

According to the documentation I am addressing the “accounts” field element correctly so I can not figure out WHY it is failing…

and even if I try just the signInStatus element that fails as well…

def resObj = WS.sendRequest(findTestObject(‘Sign In/Sign-in-API’, [(‘username’) : ‘8881110030’, (‘password’) : ‘Test-1234’
, (‘identifier_for_vendor’) : ‘1234566789’]))

WS.verifyResponseStatusCode(resObj, 200)

WS.verifyElementPropertyValue(resObj, ‘.signInStatus’, ‘LoginSuccessfull’)

WS.verifyElementPropertyValue(resObj, ‘.accounts[0].accNumber’, ‘6000112216066021’)