Error generating report in Jenkins following a Postman collection run

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 'git@gitlab.dev.com: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: "git@gitlab.dev.com: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