apideck-libraries / portman

Port OpenAPI Specs to Postman Collections, inject test suite and run via Newman 👨🏽‍🚀
http://getportman.com/
Apache License 2.0
632 stars 60 forks source link

Am I misunderstanding the use of the option `--localPostman`? #463

Open JaredAAT opened 1 year ago

JaredAAT commented 1 year ago

I see that there is an option of --localPostman which isn't overly documented, so I'm probably misunderstanding its use case.

I'm already using https://github.com/postmanlabs/openapi-to-postman to generate a postman file from my OpenAPI spec, so I then assumed that from the generated Postman Collection I could call npx @apideck/portman --localPostman postmanCollection.json to populate the Postman Collection with tests.

Calling it like this, generates:

==============================================================================================================================================================
 Portman Config:    portman-config.default.json
 Postman Config:    postman-config.default.json
 Environment:       .env
 Inject Tests:      true
 Run Newman:        false
 Newman Iteration Data: false
 Upload to Postman:     false
==============================================================================================================================================================
Error: Error initializing OpenApi Spec.
==============================================================================================================================================================

Leaving an empty tmp folder.

I take it ii'm using the option incorrectly or that manipulating an existing postman collection to add tests is not possible?

Cheers

thim81 commented 8 months ago

hi @JaredAAT

Portman is using https://github.com/postmanlabs/openapi-to-postman behind the scenes, to generate the Postman collection.

Using --localPostman, it would still need the OpenAPI spec for the additional info to generate the tests on. The OpenAPI is considered the single source, to base it tests on.

A suggestion would be to let Portman generate the Postman collection, skipping using the locally generated Postman collection.

JaredAAT commented 8 months ago

I don't actually need this functionality anymore as much as i thought i did when posting... but in your documentation it says:

--localPostman             Use local Postman collection, skips OpenAPI conversion

which to my (maybe wrong) reading, suggests i don't need to pass though an OpenAPI file, that I can pass through an already generated postman collection (via https://github.com/postmanlabs/openapi-to-postman) and that it will scan through and attach tests (or whatever you have setup your config to do).

That's my reading of what that option would do anyway.