portman icon indicating copy to clipboard operation
portman copied to clipboard

How to include common functions and headers that are sent for all requests via postman collection to the new collection generating via Portman

Open techwizardg opened this issue 1 year ago • 8 comments

First of all should appreciate the great efforts that have gone in getting Portman to this shape. How can I include common functions and headers that are sent for all requests in the global postman collection to the new collection that is getting generated via Portman.

Should we manually add to the collection which will be time consuming

techwizardg avatar Jan 05 '24 05:01 techwizardg

hi @techwizardg

Did you sort it out? Reading your question, It sounds like you are looking to use the "collectionPreRequestScripts" from https://github.com/apideck-libraries/portman#portman---globals-property

thim81 avatar Jan 05 '24 07:01 thim81

yes and the same helped and hence closed. Thanks @thim81

techwizardg avatar Jan 05 '24 07:01 techwizardg

@thim81 I am facing similar issue. prerequisite scripts which are present in file script1 are not getting added in postman collection even after doing below things. I have added below code in portman-cli-options.json "globals": { "stripResponseExamples": true, "collectionPreRequestScripts": [ "file:C:\Users\ravindra.dumpa\Downloads\script1.js" ], and using below command "portman --cliOptionsFile C:\Users\ravindra.dumpa\Downloads\examples\portman-globals\portman-cli-options.json -l C:\Users\ravindra.dumpa\Downloads\ums.yaml -o D:\newums3.postman.json -t -b http://172.25.49.214/mobiquitypay --globals.collectionPreRequestScripts"

Guide me how to solve this issue

Ravindra1510 avatar Jan 05 '24 13:01 Ravindra1510

hi @Ravindra1510

Looking at your CLI command you are mixing parameters. In the Example - Global Config you can find a working example.

thim81 avatar Jan 05 '24 15:01 thim81

Hi @thim81 thanks for the help. now I am able to add scripts in collection level pre requisite script tab but i want to add scripts for request level pre requisite script tab. Can you help me on this

Ravindra1510 avatar Jan 06 '24 08:01 Ravindra1510

hi @Ravindra1510

There is this option for: https://github.com/apideck-libraries/portman?tab=readme-ov-file#portman---operationprerequestscripts-properties

thim81 avatar Jan 08 '24 08:01 thim81

Hi @thim81 : I were able to add collection level scripts and request level scripts but when i am generating variance tests my request level scripts are not importing also can you please suggest how to configure tokens in portman-config.crm.json [For example i want to use bearerToken for all my variance tests]

ehlmnq avatar Jan 22 '24 13:01 ehlmnq

Hi @ehlmnq

If not mistaken, you can use the securityOverwrites (see example for more info)

thim81 avatar Apr 02 '24 07:04 thim81

hi @ehlmnq and @techwizardg

Where you able to get your config working as expected? If yes, feel free to close this. if no, can you share where you are stuck, so the community can perhaps assist.

thim81 avatar Jul 09 '24 21:07 thim81

Closing due to inactivity.

Since there hasn't been any feedback for the past months, I assume the issue has been resolved. If you're still experiencing problems, please feel free to reopen this issue or create a new one. Thanks for your contribution!

thim81 avatar Aug 23 '24 11:08 thim81