Schema Compliance Assertion

Applies to ReadyAPI 3.51, last modified on March 21, 2024

The Schema Compliance assertions check whether the last request or response follows the associated WSDL or WADL schema definition. This schema can be taken from the service definition, or inferred.

If the schema contains a definition of one type, and the response returns another type, the Schema Compliance assertion will always be Valid. For example, this happens if you have defined the ArrayOfInt element, but the method returns ArrayOfString.

Availability

This assertion is available in multiple ReadyAPI applications. Depending on the application, it validates the following data:

In... Checks... To learn more...
Functional tests The request or response body. See Working With Assertions in Functional Tests.
Security tests The response body. See Security Assertions.
Virtual services The request body. See Assertions in Virtual Services.

Create an assertion

Follow these steps:

Functional test: The Assertions panel

Click the image to enlarge it.

  1. Open a test step.

  2. Click Add assertion.

In the New Assertions dialog, search for the Schema Compliance assertion or select it manually in the Compliance, Status and Standards category.

Follow these steps:

Security tests: The Assertions panel

Click the image to enlarge it.

  1. Open a security test.

  2. Click Response Assertion next to any scan.

  3. Click in the Assertions panel

In the New Assertions dialog, search for the Schema Compliance assertion or select it manually in the Compliance, Status and Standards category.

Follow these steps:

Virtual service: The Assertions panel

Click the image to enlarge it.

  1. Open a virtual service.

  2. Open the Assertions drop-down panel.

  3. Click in the Assertions panel

In the New Assertions dialog, search for the Schema Compliance assertion or select it manually in the Compliance, Status and Standards category.

Setting up properties

Specify the definition URL in the field.

ReadyAPI: Specifying the definition URL for the Schema Compliance assertion

By default, ReadyAPI uses the service definition that you specified in the project to verify the schema. If you have an inferred schema, ReadyAPI will use it instead.

For the REST Request test step, you can use only the inferred schema.

  • In functional tests, if the response you receive has conflicts with a schema, the assertion fails. These conflicts appear on the Conflicts tab of the Schema panel in the response editor. You can then resolve conflicts on that tab – either manually or automatically.

    ReadyAPI: The Conflicts tab of the Schema panel

    Click the image to enlarge it.

    For more information on schemas in ReadyAPI, see Inferring REST Schemas.

  • If you receive the Missing matching representation for response with contentType error, add a new representation for the expected content type on the Representations panel:

    ReadyAPI: The Representations panel

    Click the image to enlarge it.

Add other schema compliance assertions:

See Also

Compliance, Status and Standards Assertions
JSON Schema Compliance Assertions

Highlight search results