2017-03-09 9 views
0

Ich erhalte unter json Antwort:Assertion in Json Antwort

{"participantUID": "000000000004871"} 

ich Behauptung auf participantUID tun wollen.

Mein Code:

def ResponseMessage = messageExchange.response.responseContent 

def jsonSlurper = new JsonSlurper().parseText(ResponseMessage) 

assert jsonSlurper.participantUID == expectedparticipant 

aber ich bin immer Fehler: groovy.lang.MissingPropertyException: No such property:

Bitte helfen Sie mir. Dank

+0

'' die ResponseMessage' println', wenn Sie, um zu überprüfen, was zu erwarten ist. – Opal

Antwort

0

Ich bin mir nicht ganz sicher, da Sie die komplette MissingPropertyExceptionMessage in Ihrer Frage nicht kopieren, aber da Sie richtig die Antwortinhalt mit messageExchange Kontextvariable das Problem ist wahrscheinlich, dass Sie nicht die Definition von expectedparticipant Zugriff auf in Ihre Script assertion versuchen mit:

def ResponseMessage = messageExchange.response.responseContent 
def expectedparticipant = '000000000004871' 

def jsonSlurper = new JsonSlurper().parseText(ResponseMessage) 
assert jsonSlurper.participantUID == expectedparticipant