2

We are investigating whether we can incorporate Postman Test Runner and Newman into an API testing flow with our Jenkins CI server.

My question is this: once I import a swagger/Open API file into a Postman collection, how can I keep changes from multiple team members in sync?

For example, if a team member adds a new api endpoint to the swagger file, do we have to re-import the swagger file into a postman collection overwriting it? We'd like to keep using the swagger file as the single source of truth so would like to keep that in sync with the postman collection. Ideally we would update the swagger file, commit it to git and get its changes synced to postman.

What about tests created in postman? Is there a way to keep that checked into git? Would we have to export the collection after each test change and check that into git, and re-import changes to postman collections after each git pull?

It looks like since some of the online postman features are built for sharing - the idea is that you would make a change to the collection directly in the postman client and that gets shared out to other postman clients? If so, is there a hook that can be added to sync those changes to git automatically?

Curtis Gibby
  • 884
  • 1
  • 12
  • 25
MonkeyBonkey
  • 46,433
  • 78
  • 254
  • 460

1 Answers1

1

To answer your questions in order:

Once I import a swagger/open api file into a postman collection, how can I keep changes from multiple team members in sync?

To keep your collections in sync everyone will need to sign in and use a team workspace. As of Postman 6.2 a single team workspace is now free. https://www.getpostman.com/docs/v6/postman/workspaces/intro_to_workspaces

For example, if a team member adds a new api endpoint to the swagger file, do we have to re-import the swagger file into a postman collection overwriting it?

Depends on how you are generating the file. If it is being generated using a run-time tool (e.g., NSwag, Swashbuckle) then you'll most likely end up needing to overwrite the file. If you have a swagger.json your team is directly maintaining, you can probably modify the scripts Postman provides to keep your definitions in sync with Postman: http://blog.getpostman.com/2018/03/02/sync-your-specs/

What about tests created in postman? Is there a way to keep that checked into git?

Yes. You can export Postman collections which include your tests and check those into Git.

If so, is there a hook that can be added to sync those changes to git automatically?

Answered on SO here.

Wesley Rolnick
  • 871
  • 4
  • 11