Forum Discussion
ankitaT
12 years agoContributor
For JSON format, instead of XPath, usage of jsonslurper is recommended.
An example to achieve this is as:
import groovy.json.JsonSlurper
def response = messageExchange.response.responseContent
def slurper = new JsonSlurper()
def json = slurper.parseText response
def ExpectedResultMessage = context.expand( '${#TestCase#ResultMessage}' ).toString()
log.info 'ExpectedResultMessage ' + ExpectedResultMessage
log.info 'json response ' + json."nsms.Response"."nsms.msg"
assert json."nsms.Response"."nsms.msg" == ExpectedResultMessage
Hope it helps.
Regards,
Ankita
An example to achieve this is as:
import groovy.json.JsonSlurper
def response = messageExchange.response.responseContent
def slurper = new JsonSlurper()
def json = slurper.parseText response
def ExpectedResultMessage = context.expand( '${#TestCase#ResultMessage}' ).toString()
log.info 'ExpectedResultMessage ' + ExpectedResultMessage
log.info 'json response ' + json."nsms.Response"."nsms.msg"
assert json."nsms.Response"."nsms.msg" == ExpectedResultMessage
Hope it helps.
Regards,
Ankita
Related Content
- 10 months ago
- 5 years ago
- 6 years ago
- 2 years ago
- 9 years ago
Recent Discussions
- 21 days ago