github.com/jaylevin/jenkins-library@v1.230.4/documentation/docs/steps/newmanExecute.md (about) 1 # ${docGenStepName} 2 3 !!! warning "Deprecation notice" 4 Details of changes after the step migration to a golang can be found [below](#exceptions). 5 6 ## ${docGenDescription} 7 8 ## Prerequisites 9 10 * prepared Postman with a test collection 11 12 ## ${docGenParameters} 13 14 ## ${docGenConfiguration} 15 16 ## Side effects 17 18 Step uses `dockerExecute` inside. 19 20 ## ${docJenkinsPluginDependencies} 21 22 ## Exceptions 23 24 The step has been migrated into a golang-based step. The following release notes belong to the new implementation: 25 26 - **newmanRunCommand**: 27 28 The parameter `newmanRunCommand` is deprecated by now and is replaced by list parameter `runOptions`. For backward compatibility, the `newmanRunCommand` parameter will still be used if configured. Nevertheless, using this parameter can break the step in some cases, e.g. when spaces are used in single quoted strings like spaces in file names. Also Groovy Templating is deprecated and now replaced by Go Templating. The example show the required changes: 29 30 ```yaml 31 # deprecated groovy default 32 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'" 33 ``` 34 35 ```yaml 36 # new run options using golang templating 37 {{`runOptions: ["run", "{{.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"]`}} 38 ``` 39 40 If the following error occurs during the pipeline run, the `newmanRunCommand` is probably still configured with the deprecated groovy template syntax: 41 > info newmanExecute - error: collection could not be loaded 42 > info newmanExecute - unable to read data from file "${config.newmanCollection}" 43 > info newmanExecute - ENOENT: no such file or directory, open '${config.newmanCollection}' 44 45 - **newmanEnvironment and newmanGlobals**: 46 47 Referencing `newmanEnvironment` and `newmanGlobals` in the runOptions is redundant now. Both parameters are added to runCommand using `newmanEnvironment` and `newmanGlobals` from config when configured and not referenced by go templating using `"--environment", "{{`{{.Config.NewmanEnvironment}}`}}"` and `"--globals", "{{`{{.Config.NewmanGlobals}}`}}"` as shown above. 48 49 ## Example 50 51 Pipeline step: 52 53 ```groovy 54 newmanExecute script: this 55 ``` 56 57 This step should be used in combination with `testsPublishResults`: 58 59 ```groovy 60 newmanExecute script: this, failOnError: false 61 testsPublishResults script: this, junit: [pattern: '**/newman/TEST-*.xml'] 62 ```