I am validating json schema using matchesJsonSchemaInClasspath
. It is working fine if response body have the same values that are defined in schema.json
file.
If response body have EXTRA variable / value which is not define in json schema then it does not fail. How to fail this test case?
FOR EXAMPLE:
Below is response body which has predefined JSON schema.
{
"employee": {
"name": "sonoo",
"salary": 56000,
"married": true
}
}
If response body gives extra values such as email / phone then it is still passing. I need to make it fail.This is my test case to fail if response body return extra value. How to validate this test case?
{
"employee": {
"name": "Mike",
"salary": 56000,
"Phone": "+XXX",
"email": "test@gmail.com",
"married": true
}
}