Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
techwizardg opened this issue Jan 5, 2024 · 8 comments

Comments

@techwizardg
Copy link

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

@thim81
Copy link
Collaborator

thim81 commented Jan 5, 2024

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

@techwizardg
Copy link
Author

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

@Ravindra1510
Copy link

Ravindra1510 commented Jan 5, 2024

@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

@thim81
Copy link
Collaborator

thim81 commented Jan 5, 2024

hi @Ravindra1510

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

@Ravindra1510
Copy link

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

@thim81
Copy link
Collaborator

thim81 commented Jan 8, 2024

@ehlmnq
Copy link

ehlmnq commented Jan 22, 2024

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]

@thim81 thim81 reopened this Jan 30, 2024
@thim81
Copy link
Collaborator

thim81 commented Apr 2, 2024

Hi @ehlmnq

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants