Validate Json Response by the negative #239
-
Hey I'm new to using the framework and I have a scenario which I would like to validate, in which I would to certain fields don't show up on there response. I know there is a .JsonExpect() which I can specify the fields I want to validate, is there a way to validate the oposite? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
There is no ideal way to validate opposites. But notIncludes matcher would help to perform these kind of assertions to some extent. |
Beta Was this translation helpful? Give feedback.
-
Tried using the notIncludes but I keep getting the error:
Here is my sample test:
This is the response from my API:
I want to validate that the sendBirdAccessToken isn't sent on the response. |
Beta Was this translation helpful? Give feedback.
Tried using the notIncludes but I keep getting the error:
AssertionError [ERR_ASSERTION]: Json doesn't have a "object" at "$.sendBirdAccessToken"
Here is my sample test:
This is the response from my API:
{ "id": "someid", "username": "ovz1wot3e", "email": "[email protected]", "dateOfBirth": null, "sendBirdAccessToken": "token", "products": [], "myReviews": [], "kyc": null, "deliveryAddresses": [ ] }
I want to validate that the sendBirdAccessToken isn't sent on the response.