The Swagger Compliance assertion verifies that the response corresponds with the specified definition. The assertion supports the following specifications:
Swagger 2.0 (also known as OpenAPI 2.0)
|In...||Checks...||To learn more...|
|SoapUI functional tests||The response.||See Working With Assertions in SoapUI.|
|ServiceV||The request.||See Assertions in ServiceV.|
Follow these steps:
Open the virtual service.
Select the operation you want to assert.
Click in the Assertions panel.
In the New Assertions dialog, search for the Swagger Compliance Assertion assertion or select it manually in the Compliance, Status and Standards category.
|You cannot apply this assertion to the entire virtual service, you can apply it only to individual operations.|
In the Swagger URL field, specify the file name or URL of the desired OpenAPI or Swagger specification.
If the definition's URL requires authentication, you will be prompted to enter credentials.
If you enable the Strict Mode option, the assertion will fail if the definition does not contain the appropriate response. If you disable this option, the assertion passes if the response code is not specified in the definition.
How the assertion works:
The assertion gets a response code. Then, it searches for the corresponding status code specified in the definition and checks if the response has an appropriate content-type.
If the definition specifies the response body, the assertion verifies if the response body coincides with the specified schema.
(Only for Open 3.0.0 specifications) If the response status code is not defined in the definition, the assertion compares the response against the
|Currently, the assertion does not support the range of responses.|
By default, if the assertion cannot find an appropriate HTTP status code, it passes. If you want the assertion to fail in such cases, enable the Strict mode option.
When an assertion runs for the first time, ReadyAPI loads the definition into an internal cache. During the following runs, the assertion uses a cached version of the definition. ReadyAPI clears the cache when it is closed.
Add other schema compliance assertions: