我正在YAML管道中使用任务“ Newman the cli Companion for Postman”(Link)来运行Postman集合以进行测试和预热。
我使用以下任务:
- task: carlowahlstedt.NewmanPostman.NewmanPostman.NewmanPostman@4
displayName: 'Newman - Postman'
inputs:
collectionFileSource: '$(Pipeline.Workspace)/drop/Postman'
Contents: '**\*_collection.json'
folder: Release
environment: '$(Pipeline.Workspace)/drop/Postman/$(Environment).postman_environment.json'
ignoreRedirect: false
bail: false
sslInsecure: false
reporters: 'html,junit'
reporterHtmlExport: '$(Pipeline.Workspace)/drop/Postman'
htmlExtraDarkTheme: false
htmlExtraLogs: false
htmlExtraTestPaging: false
reporterJUnitExport: '$(Pipeline.Workspace)/drop/Postman'
在托管代理上执行此操作可以正常工作,但与自托管代理一起使用时,我会得到:
##[error]Unable to locate executable file: 'newman'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.
我在代理程序上安装了newman以及newman-reporter-html,并且能够在登录到代理程序时运行它。
如何解决此问题?
答案 0 :(得分:0)
要解决我添加的问题
pathToNewman: 'C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\npm\newman.cmd'
到任务定义。如果代理未找到版本,则使用该路径。
结果,任务看起来像
- task: carlowahlstedt.NewmanPostman.NewmanPostman.NewmanPostman@4
displayName: 'Newman - Postman'
inputs:
collectionFileSource: '$(Pipeline.Workspace)/drop/Postman'
Contents: '**\*_collection.json'
folder: Release
environment: '$(Pipeline.Workspace)/drop/Postman/$(Environment).postman_environment.json'
pathToNewman: 'C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\npm\newman.cmd'
ignoreRedirect: false
bail: false
sslInsecure: false
reporters: 'html,junit'
reporterHtmlExport: '$(Pipeline.Workspace)/drop/Postman'
htmlExtraDarkTheme: false
htmlExtraLogs: false
htmlExtraTestPaging: false
reporterJUnitExport: '$(Pipeline.Workspace)/drop/Postman'
我不确定为什么找不到自己安装的版本。因此,如果有人有一个主意,那就太好了。