Forum Discussion
nmrao
8 years agoChampion Level 3
Not familiar with JsonPath.
However, below Script Assertion should help you achieve the same.
import groovy.json.JsonSlurper
//Here defined the expected list def expectedList = ['kitten-1', 'kitten-2'] def json = new JsonSlurper().parseText(context.response)
//The result is sorted in the below statement def actualList = json.entities.alias.sort()
//Hence, order should not matter for asserting the response. assert actualList == expectedList, "Response alias names don't match"
Related Content
- 6 months agosohailalam2696