Need to run a few collections simultaneously

I create an infrastructure with reusable scripts, so all my scripts are stored in a collection called Library.
I created environment variables
I am using a collection of variables for a test run
globals are used to store the functions.

So from my main collection called 'Sanity," I am calling by using
this code
to reuse my scripts.

Problem - now I am trying to create a ci/cd process and I can’t run this all together!

This is the command that I copied from Postman CLI
*postman collection run 32090846-92860d15-2359-4903-a5d3-8e8207252b19 -e 32090846-bebc35a4-f9ea-4665-83fd-bb4d2b516748*

If I am running it directly from Postman everything is working great but from CLI all tests are falling

Question: How can I run 2 collections and environment variables and globals at once via CLI? It must be done at once because of the reusable scripts

So I created something really simple but still cant run it

Hi @technical-engineer16. Welcome to the Postman community!

What you want to do can be best achieved by using a single collection with an environment variable. Is there any reason why you’re not storing the reusable script in an environment variable?

Currently, there is no way to run multiple collections in a workspace simultaneously and global variables are not available in CLI runs. Additionally, when using environment variables, ensure that the variables are stored as “initial values” which are synced with Postman servers. Variables stored as “current values” do not get synced with Postman servers are are not shared across a team workspace and hence will not be available in a CLI run.

Pretty sure you can’t.

Both Newman and the Postman CLI run Collections. They don’t have access to the underlying workspace.

The details for a collection run do not persist after the collection run, so if you run one collection, then another, no variables from the first collection run will be available to the second one.

Globals from a work space will not be available.

What you could do is put each script into an environment variable, and eval that instead of the global variable. But you already appear to be using an environment, so I suspect that option won’t work for you.

You could potentially put the scripts into a data file, and then use the data file in your command line, and eval from there. Each script would need to be wrapped in a string and escaped properly. Run the code through an online minifier first.

So this is how I resolved it.

I duplicated my scripts into the project the scripts are stored in global and env is used only for env parameters.

The problem is IF I need to use these scripts in some over collection I need to duplicate them to the collection and it is pretty stupid :slight_smile:

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