postmanlabs / newman

Newman is a command-line collection runner for Postman
https://www.postman.com
Apache License 2.0
6.86k stars 1.16k forks source link

Getting error when invoking the Postman collection from Jenkins #3019

Open chandruswaminathan opened 2 years ago

chandruswaminathan commented 2 years ago

Hi,

In Jenkins, when i provide the command as "newman run C:\Users\chandru\Desktop\API.postman_collection.json" the below error is displayed in the console. But when running through JSON link getting executed successfully. Please help to solve this issue

Running as SYSTEM Building in workspace /var/lib/jenkins/workspace/Postman [Postman] $ /bin/sh -xe /tmp/jenkins4865641259898593308.sh

chandruswaminathan commented 2 years ago

In addition, the same command( "newman run C:\Users\chandru\Desktop\API.postman_collection.json") is getting executed from command prompt successfully. But when executed from PowerShell/Jenkins facing issue as collection could not be loaded

malvikach commented 2 years ago

Hello @chandruswaminathan I believe the path specified might be a problem. In your local, you might have the given collection file existing in the path specified i.e. C:\Users\chandru\Desktop\API.postman_collection.json

However, on your Jenkins server, please make sure you are using the correct paths.

chandruswaminathan commented 2 years ago

Hi @malvikach, thanks for your suggestion. The path specified in the Jenkins server is correct, as I am able to execute from Command Prompt successfully. When trying through PowerShell and Jenkins I am facing the above issue.

malvikach commented 2 years ago

@chandruswaminathan Are you running the Jenkins server locally or on CI.

If you are running Jenkins server locally and still getting the above error, I would request you to check if the file exists using ls command on your C:\Users\chandru\Desktop\ directory. Please also check if the permissions to read this json file look correct. If you are running this in CI, I am doubtful that C:\Users\chandru\Desktop\ would be found on the Pipeline server. You might have to commit the collection json file to your repository and then give the correct path.