Verify element property fails when there is a hyphen in json element name

Operating System : Windows 10
Katalon Studio Version : 5.10.1
Environment : API testing

I have json elements like
“created-by”: “abc”,
“updated-by”: “xyz”

When I use
WS.verifyElementPropertyValue(response, ‘[0].updated-by’, ''xyz")
I get Verification FAILED
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to verify element property value (Root cause: Variable ‘by’ is not defined for test case.)
and when i use
WS.verifyElementPropertyValue(response, ‘[0][“updated-by”]’, ‘xyz’)
i get
Unable to verify element property value (Root cause: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 1: unexpected token: [ @ line 1, column 93.
rseText(jsonText);return root.[0]["updat

this is the thread where i have asked a question and got to know it is a bug

Is this bug fixed? I am getting a similar bug for comparing two values (one from JSON response and other from Database value).

Here is the code:

if ((sourceRequestId1.length() > 1) && (DBsourceRequestId.length() > 1)) {

AssertionPassed = WS.verifyElementPropertyValue(response1, sourceRequestId1, DBsourceRequestId)

if(AssertionPassed){
	message = "The OrderId from API matches with DB Value" + sourceRequestId1 + " assertion passed"
} else {
	
	message = "The OrderId from API matches with DB Value" + sourceRequestId1 + " assertion failed"
}

}

Getting the below error:

2020-02-18 02:44:58.707 DEBUG 004_Proxy_GenerateDocsReqs_byAPIChaining - 1: AssertionPassed = verifyElementPropertyValue(response1, sourceRequestId1, DBsourceRequestId)
2020-02-18 02:44:58.753 ERROR c.k.k.core.keyword.internal.KeywordMain - :x: Unable to verify element property value (Root cause: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 1: unexpected token: 1392 @ line 1, column 93.
rseText(jsonText);return root.1392;
^

1 error

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.