Open API Schema 3.0 Contract Testing

I am using the contract testing functionality in the API section. I have create a collection to test and I have imported the OpenAPI definition but when I click on validate I always receive Validation OK, even if i use a mock to force an invalid json response that does not match with the schema definition.

Do you have any idea?

thanks a lot

Hi @Moon, I’m also having this issue and wondering if you solved it. Seems like the contract testing tests some parts but not the validity of the response body. I can copy and past the schema into the javascript tests and validate it with tv4 just fine, but that sort of diminishes the value here.

The documentation seems to indicate support for this feature:

Hard to believe such an obvious feature would be missing.

There is a whole lot of validation going on so it can be confusing to follow each step. This validation is making sure the collection you generated from your OpenAPI still in alignment. This validation isn’t making sure the response of each API is valid, it is for making sure OpenAPI contract is met, not the individual API schema contract. Does that make sense? We have a lot of work to do in defining the right words to use for this process. Try changing a path name in your collection, and you should see it not validate.

That make sense.
Thanks a lot for your help!

1 Like

Hi @Moon

I have created a PR on the OpenApi-to-Postman library,that would allow you to generate your Postman collection including several Postman tests .

The goal of this PR is to facilitate contract testing via Postman, based on your based on your openapi specification.

Currently the following Postman tests are generated automatically:

  • Success status check
  • Response time check
  • Content-type check
  • JSON schema validation
  • JSON body check

Perhaps this will solve your request with regards to the contract testing.
Feel free to give feedback on the PR.

1 Like