Reputation: 1
Configuration :
- task: NewmanPostman@4
inputs:
collectionSourceType: 'url'
collectionURL: 'https://api.getpostman.com/collections/{collectionId}?apikey={apiKey}'
environmentSourceType: 'url'
environmentUrl: 'https://api.postman.com/environments/{enviormentId}?apikey={apiKey}'
reporters: 'htmlextra'
pathToNewman: '/opt/hostedtoolcache/node/18.15.0/x64/bin/newman'
htmlExtraDarkTheme: true
htmlExtraReportTitle: 'ExploreFunctionalTestSummary'
reporterHtmlExport: '$(Pipeline.Workspace)/drop/Postman'
verbose: true
logLevel: detailed
sslInsecure: false
Error : throwing issue ##[error]The process '/opt/hostedtoolcache/node/18.15.0/x64/bin/newman' failed with exit code 1
Debug same scenario on local system after newman install, but got collection not loading ,
error: collection could not be loaded unable to fetch data from url "*https://api.getpostman.com/collections/{collectionId}?apikey={apiKey}*"
Provide the correct approch to implement it without ollectionfile/enviormentfile
Upvotes: 0
Views: 250
Reputation: 8478
NewMan is preinstalled on Ubuntu-latest
agent, the version is 6.1.1
.
As per the guide:
different
version of newman, you can install with npm task as below: - task: Npm@1
displayName: NewMan install
inputs:
command: 'custom'
customCommand: 'install [email protected] -g'
For the pathToNewman
parameter, it points to the newman path if you don't want to use the default version.
Unless you have newman installed on the path /opt/hostedtoolcache/node/18.15.0/x64/bin/newman
, please remove the parameter in the task NewmanPostman@4
.
htmlextra
reporter type, you need to install newman-reporter-htmlextra
ahead via npm task: - task: Npm@1
displayName: NewMan reporter htmlextra install
inputs:
command: 'custom'
customCommand: 'install -g newman-reporter-htmlextra'
My complete yaml below, i added the comment on the tasks.
pool:
VMImage: Ubuntu-latest
steps:
- script: newman --version
# - task: Npm@1 # commented as i used default Newman
# displayName: NewMan install
# inputs:
# command: 'custom'
# customCommand: 'install [email protected] -g'
- task: Npm@1
displayName: NewMan reporter htmlextra install
inputs:
command: 'custom'
customCommand: 'install -g newman-reporter-htmlextra'
- task: NewmanPostman@4
inputs:
collectionSourceType: 'url'
collectionURL: 'https://api.getpostman.com/collections/$(collectionid)?apikey=$(apiKey)'
environmentSourceType: 'url'
environmentUrl: 'https://api.postman.com/environments/$(environmentid)?apikey=$(apiKey)'
reporters: 'htmlextra'
#pathToNewman: '/opt/hostedtoolcache/node/18.15.0/x64/bin/newman' # comment it as i use default newman
htmlExtraDarkTheme: true
htmlExtraReportTitle: 'ExploreFunctionalTestSummary'
# reporterHtmlExport: 'drop/Postman' # i used default newman path for the output path
verbose: true
logLevel: detailed
sslInsecure: false
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Pipeline.Workspace)/s'
ArtifactName: 'drop'
publishLocation: 'Container'
Edit: Add the variable list:
Upvotes: 0