File upload scenario through Jenkins using Newman API options

Hi All,

I am new to postman and working on the scenario to upload file with api and run through jenkins. We are using the bit bucket as repositories and using the newman api options to run the postman collection. Please find the below newman code:

await postman({
collection: [url to postmanCollection],
environment: [postmanEnvironment],
iterationData: [url to postmanDataFile],
reporters: [‘cli’, ‘json’, ‘htmlextra’],
reporter: {
json: {
export: results.json
},
htmlextra: {
export: results.html
}
}

if we are placing the files in git repo (same as the collection json file), I am getting the 500 response.

Collection.json screenshot:

image

Response screenshot:

image

Can anyone please let me know what can I do to run the file upload scenario through Jenkins. can we set url as workingDir option in newman command ?

Note: we are using the newman api options to run the collection. so how can we set the workingDir option as url.

1 Like

I created an example Jenkinsfile that is making use of the postman-cloud reporter plugin and some additional ones showing how to upload results using newman and postman: Jenkinsfile showing advanced Postman CLI and newman integration including custom reporters and reporting status back to Postman · GitHub

I still did not get it.
I’m in a similar situation but I have all the tests in Postman and Jenkins uses Postman API to get collections and environment variables.
Images for upload are loaded to the Postman cloud.
Locally all good. But tests failed on Jenkins with error like
│ ‘Form param file, file load error: “postman-cloud://
│ /{{fileID}}”, no such file’

Can someone suggest how to handle it?