oasis
(Sunil)
October 9, 2020, 12:10pm
1
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 ;-
gpub1
(gp)
October 9, 2020, 9:12pm
2
seems like newman command is wrong with initial looking, please share the log file ?
oasis
(Sunil)
October 9, 2020, 11:39pm
3
@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.
gpub1
(gp)
October 12, 2020, 1:57pm
4
good its working now ⌠no need for logs keep working
oasis
(Sunil)
October 12, 2020, 2:09pm
5
@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'
}
}
}
gpub1
(gp)
October 12, 2020, 2:15pm
6
Looks like again due to some spacing in path
try removing -g from this command sh 'npm install -g newman''
oasis
(Sunil)
October 12, 2020, 2:19pm
7
@gpub1 , It didnât help unfortunately
gpub1
(gp)
October 12, 2020, 2:30pm
8
oasis:
Found 0 xml files
for you hopefully this help Notfound