this is the response {
“user”: {
“name”: “Ali”,
“age”: 38,
“interests”: [“Groovy”, “Grails”]
}
}
code looks like this
addTransactionResponse = WS.sendRequest(findTestObject(‘create transaction/addtransaction’))WS.verifyElementPropertyValue(findTestObject(addTransactionResponse), ‘user.name’, ‘Ali’)
Ibus
2
when you do:
addTransactionResponse = WS.sendRequest(findTestObject('create transaction/addtransaction'))
the addTransactionResponse object is of ResponseObject type.
therefore, to validate a given key, something like
WS.verifyElementPropertyValue(addTransactionResponse, 'user.name', 'Ali')
should do the job. There is no need to call findTestObject again
1 Like