Forum Discussion
mgroen2
Super Contributor
nmrao wrote:
For the mentioned case, JsonPatMatch is fine.
$.accessToken should equal to the desired value.
nmraoI entered this (see screenshot), but it's not working. as you can see there is an accesstoken in the response, but validating it gives an error (it thinks it should be false?). Do you have any tips?
nmrao
8 years agoChampion Level 3
You should be able to try here
http://jsonpath.com/
Following Script Assertion should help:
def parsedJson = new groovy.json.JsonSlurper().parseText(context.response)
log.info parsedJson.accessToken
//replace expectedValue below
assert expectedValue == parsedJson.accessToken, 'Not matched.'
You can also check here:
http://groovyconsole.appspot.com/script/5179916383420416
http://jsonpath.com/
Following Script Assertion should help:
def parsedJson = new groovy.json.JsonSlurper().parseText(context.response)
log.info parsedJson.accessToken
//replace expectedValue below
assert expectedValue == parsedJson.accessToken, 'Not matched.'
You can also check here:
http://groovyconsole.appspot.com/script/5179916383420416
Related Content
- 6 years ago
Recent Discussions
- 3 days ago