diff --git a/resources/default_pipeline_environment.yml b/resources/default_pipeline_environment.yml index d95541665..cf0ecc851 100644 --- a/resources/default_pipeline_environment.yml +++ b/resources/default_pipeline_environment.yml @@ -95,7 +95,7 @@ steps: newmanCollection: '**/*.postman_collection.json' newmanEnvironment: '' newmanGlobals: '' - newmanRunCommand: "run ${config.newmanCollection} --environment '${config.newmanEnvironment}' --globals '${config.newmanGlobals}' --reporters junit,html --reporter-junit-export target/newman/TEST-${config.newmanCollection.toString().replace(File.separatorChar,(char)'_').tokenize('.').first()}.xml --reporter-html-export target/newman/TEST-${config.newmanCollection.toString().replace(File.separatorChar,(char)'_').tokenize('.').first()}.html" + newmanRunCommand: "run ${config.newmanCollection} --environment '${config.newmanEnvironment}' --globals '${config.newmanGlobals}' --reporters junit,html --reporter-junit-export target/newman/TEST-${collectionDisplayName}.xml --reporter-html-export target/newman/TEST-${collectionDisplayName}.html" pipelineStashFilesAfterBuild: runOpaTests: false stashIncludes: diff --git a/vars/newmanExecute.groovy b/vars/newmanExecute.groovy index 4bc721318..876622641 100644 --- a/vars/newmanExecute.groovy +++ b/vars/newmanExecute.groovy @@ -37,10 +37,14 @@ def call(Map parameters = [:]) { ) { sh 'npm install newman --global --quiet' for(String collection : collectionList){ + def collectionDisplayName = collection.toString().replace(File.separatorChar,(char)'_').tokenize('.').first() // resolve templates def command = SimpleTemplateEngine.newInstance() .createTemplate(config.newmanRunCommand) - .make([config: config.plus([newmanCollection: collection])]).toString() + .make([ + config: config.plus([newmanCollection: collection]), + collectionDisplayName: collectionDisplayName + ]).toString() if(!config.failOnError) command += ' --suppress-exit-code' sh "newman ${command}" }