Folders Not Included During Collection Run Through CLI

I’ve noticed this peculiar issue where in some folder including Postman requests are not getting executed while running the collection through CLI.

My Folder structure looks something like this:

Collection

  • Persona
    • Module 1
      • API One
        • Positive Cases
          Postman Request One
          Postman Request Two
        • Negative Cases
          Postman Request One
          Postman Request Two
      • API Two
        • Positive Cases
          Postman Request One
          Postman Request Two
        • Negative Cases
          Postman Request One
          Postman Request Two
    • Module 2
      • API One
        • Positive Cases
          Postman Request One
          Postman Request Two
        • Negative Cases
          Postman Request One
          Postman Request Two
      • API Two
        • Positive Cases
          Postman Request One
          Postman Request Two
        • Negative Cases
          Postman Request One
          Postman Request Two

I’ve been using [email protected] and [email protected] packages to reporting. Any suggestions on why this is happening would greatly be appreciated.

Thanks,
Gourish

Hey @gourish-mahale

What is the command being used to run this and are there any scripts at the Collection/Folder/Request level that contain either the skipRequest or setNetRequest command?

Thank you for responding @danny-dainton

Here is the command I’ve used through CLI.

newman run PreTUPS_API_Automation.postman_collection.json -e Postgres_Env.postman_environment.json -g workspace.postman_globals.json --folder “API Tests” -r allure,cli --reporter-allure-export “Api Automation Report” | tee cli_logs.txt

No. On Collection/Folder level I’ve not used these functions skipRequest or setNetRequest. In some requests I’ve used these functions intentionally.

Strange thing is that, sometime all folder contaning requests will be included during execution and sometime they won’t.

What sub folders and requests are under this?

–folder “API Tests”

I don’t quite understand you do or don’t use the setNetRequest function ? Is there logic wrapped around that if you use it in the requests.

No. On Collection/Folder level I’ve not used these functions skipRequest or setNetRequest. In some requests I’ve used these functions intentionally.

Can you share the actual code snippet?

You need to share a lot more granular information about each aspect of the Collection. If you removed the --folder flag from the command or remove any references to setNetRequest() it would just run the full collection from top to bottom as you see it in the sidebar on the Postman UI.

The only way that order changes or it misses out requests, is if you have something in there telling it to do that.

This is folder structure:

I’m aware of the execution flow. And in regards to the setNextRequest() function, I have used it in some of the requests in Post-Response section. Posting screenshot for reference:

skipRequest function I’ve used in only one request because this request is taking too much of time.

Will adding these functions in any of the request impact other folder not to get executed while running the collection through CLI? Strange thing is this issue doesn’t happens during every execution.

Thanks,
Gourish

I just ran one of those sub folders from API Tests folder which were not getting executed individually through CLI and all the request from that folder got executed successfully.

I used this command:

newman run PreTUPS_API_Automation.postman_collection.json -e Postgres_Env.postman_environment.json -g workspace.postman_globals.json --folder “Agent Category” -r allure,cli --reporter-allure-resultsDir allure-results

@danny-dainton I got the issue. There were two requests with the same title.

I was using setNextRequest function in post-response section to re-execute the same request if validation was not done according to the expection. Little did I know that Postman will execute the request from some other folder with the same title which was letting all the requests b/w these two requests with same title not to get executed.

Thought of letting you know so that concerned team won’t spend time in investigating what I reported.

Thanks,
Gourish

1 Like

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