I’m looking to validate the response body dynamically. I have an endpoint which, depending on the user permissions, returns different bodies. For example:
user: a
{
"one": "a",
"two": "b"
}
user: b
{
"one": "a",
"three": "c"
}
I know that I can use jsonPath
to validate if one json field exists or not in this way:
http("Request")
.get(url)
.header(user_a_token)
.check(jsonPath("one").exists)
.check(jsonPath("two").exists)
.check(jsonPath("three").notExists)
However, I want to make it configurable, using a feeder or something like:
http("Request")
.get(url)
.header(user_token)
// iterate a list of Strings with the json field names
Thoughts?