How do I use WS.verifyElementPropertyValue in checking the REST response value?

I have the following response:


I want to check verify the value of totalExecutions tag value for “-1” which is “0”.
I have the code below:

def search_test_cycle = WS.sendRequest(findTestObject(‘JIRA/ZAPI-Get List of Cycle’, [(‘authorization’) : GlobalVariable.JIRA_Authorisation, (‘projectId’) : GlobalVariable.JIRA_Project_ID, (‘url’) : GlobalVariable.JIRA_URL, (‘versionId’) : ‘’, (‘cycleId’) : ‘’, (‘issueId’) : ‘’]))
WS.verifyResponseStatusCode(search_test_cycle, 200)
WS.verifyElementPropertyValue(search_test_cycle, ‘-1.-1.totalExecutions’, ‘0’)

However, I get the error below:
Unable to verify element property value (Root cause: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:e[0;39m
e[31mScript1.groovy: 1: unexpected token: -

I tried using the following:

WS.verifyElementPropertyValue(search_test_cycle, ‘’-1.-1.totalExecutions’’, ‘0’)

However, i get the error below:
Expected element property value ‘0’ is not equal with actual property value ‘null’

that is definitely not right, try something like:


not sure if it will work, somebody has to kill the developer who had such smart idea to make such key-names …

explanation: you have an object with a ‘-1’ property which has an array as value. so you need first element [0] of it, from which you again must get the ‘-1’ property from which you need the ‘totalExecution’ property …:grimacing:

i have formatted a bit the JSON you provided to me more readable (was missing a comma too … and the formatter has changed the object order, but i hope you will get the idea):

  "-1": [
      "1": {
        "totalExecutions": 2
      "-1": {
        "totalExecutions": 0

It worked with this:
WS.verifyElementPropertyValue(search_test_cycle, “’-1’[0].’-1’.‘totalExecutions’”, ‘0’)