I am trying to run my Postman collections, which are in a git repo, through Jenkins pipeline job, but I get the error -->> sh: newman: command not found
Steps:
- Export collections from Postman
- Push these to a Git repo.
- Run these collections in Jenkins
Contents of package.json in the project:-
{
"name":"tests",
"version":"1.0.0",
"description":"tests",
"directories":{
"tests":"PostmanCollection",
"environments":"PostmanEnvironment"
},
"scripts":{
"test123":"newman run PostmanCollection/wms_int_b.json --folder Automated -e PostmanEnvironment/Local.postman_environment.json -k --reporters junit"
},
"repository":{
"type":"git",
"url":"[email protected]:test.git"
},
"author":"AB",
"dependencies":{
"newman":"^5.2.0",
"npm":"^6.14.8"
}
}
Jenkins pipeline script from jenkinsfile:
pipeline{
agent { label 'build' }
stages {
stage('Run API Tests') {
steps {
sh 'npm run test123'
}
}
}
}
Any suggestions would be really helpful. I believe its got to do with Node.js as Newman needs it. Some people have suggested I need to run this in a docker, but I have no idea how to configure it.
Install newman in jenkins Try this
pipeline{ agent { label 'build' }
}