Error generating report in Jenkins following a Postman collection run

Archived topic — this may be out of date.
Newman has been replaced by the Postman CLI, Postman’s official, signed command-line tool. It runs collections as Newman did, and also lints API specs, runs mocks and monitors, and syncs local files with Postman from your terminal, CI/CD pipeline or coding agent.
Working with an AI coding agent? The Postman plugin lets agents in Claude Code, Cursor, Codex and others design, mock, test and ship APIs with Postman.
For current help, see the Postman docs, try the free Postman tools (no account needed), or join us on Discord.

I have been struggling with generation of report in Jenkins and I was wondering if anyone could throw some light into it.

Collection from package.json:-

“scripts”: {
“api-tests”: “newman run postmancollection/test_Api.postman_collection.json -e PostmanEnv/Test.postman_environment.json --reporters cli,junit --reporter-junit-export newman.xml --insecure”
},

Pipeline:-

        pipeline {
      agent {
            docker {
                image 'node:10-alpine'
                args '-p 3000:3000 -p 5000:5000'
                args '-u 0:0'

            }
      }

       stages{
          stage('Postman tests') {
             steps{
                
               git '[email protected]:t2-test-automation/tests.git'
                sh  'npm install -g newman'
                   sh  'npm run api-tests'
                    junit  'newman.xml'
       
             }
          }
       }
    }

Error ;-

seems like newman command is wrong with initial looking, please share the log file ?

@gpub1, I have to raise a ticket to get the logs unfortunately. However, I can see the tests being run, though failed which is expected, with cli report.

good its working now … no need for logs :slight_smile: keep working :+1:

@gpub1 Thanks, but I do have another question if that’s ok?
I am able to run the below command locally and get the xml reports as expected, but when I run it through a pipeline job, I get the message, ‘Found 0 xml files’

newman run postmancollection/SampleTests.postman_collection.json --reporters cli,junit --reporter-junit-export newman.xml

Pipeline:-

pipeline {
agent {
docker {
image ‘node:10-alpine’
args ‘-p 3000:3000 -p 5000:5000’
args ‘-u 0:0’

    }

}

stages{

    stage("Checkout API-Test") {
        steps {
   
            checkout(
                    [$class           : 'GitSCM',
                     branches         : [[name: "master"]],
                     userRemoteConfigs: [[url: "[email protected]:test-automation/tests.git"]]]
              
            )

    }
    }
   
   
   
  stage('Postman tests') {
     steps{
        
       script{
           try{
        sh 'npm install -g newman'
           sh 'npm run api_sample'
           currentBuild.result = 'SUCCESS'
          

     } catch (Exception ex) {
                    currentBuild.result = 'FAILURE'
                }
     }
       junit 'newman.xml'

}
}
}

Looks like again due to some spacing in path
try removing -g from this command sh 'npm install -g newman''

@gpub1, It didn’t help unfortunately

for you hopefully this help Notfound