# Response Validators

In vREST, assertions can further invoke validators to validate the test case responses. A response validator is simply a JavaScript function. A test case passes if the assigned response validator returns true otherwise it fails.

# Types of Validators

vREST provides the following default response validators, and also provide you a way to define your own custom validator.

  1. Default Validator validates the expected and actual responses (response body) for exact match. If the value doesn't match, it simply fails the test case. We need to define Expected Body for the test case, if we choose this. Any variables in expected body are first replaced and then provided to the validator for response validation.

  2. Default Schema Validator validates the schema of actual response instead of checking for exact content match. We need to define Expected Schema for the test case, if we choose this. If we use this validator, then we don't need to define the Expected Body.

  3. Custom Validator validates the actual response by your own way. Most of the cases of response validation can be handled with the above default validators and built-in assertion operators. However, you may define your own custom validators/operator for customized response validation.

For more information on this, please read our guide on Custom Validator / Operator.