How to create mock server from OpenAPI spec? (CDD)

Im able to import OpenAPI spec as API in Postman. Im able to generate mock server from collections. But i dont see a way to connect these two - create mock server from API spec like for example in SoapUI, ReadyAPI, Traffic Parrot etc do.

Im testing various tools in context of CDD (Contract Driven Development). Thats a methodology when contract (api spec) is created/edited first, and then code (api server and api client) has to be adjusted to it. In this concept API client will not be developed and tested (CI phase) against real servers but mocked servers created from api spec.

If you’re using the latest version of Postman, you can copy the generated collection over to Collections, and then add a mock. It’s a bit different than earlier versions. In more detail:

  • Import the API spec with Collection
  • Under the collection (still under the APIs tab) > Copy to collections
  • Now you will see the collection under the Collections tab > Mock collection

There’s also a recent session on API contract testing that doesn’t address this particular workflow of CDD, but may give you some ideas: API Contract Testing | Postman Intergalactic

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.