【问题标题】:Azure DevOps Pipelines: Newman the cli Companion for Postman on a self-hosted agent (Windows)Azure DevOps Pipelines:Newman 自托管代理 (Windows) 上 Postman 的 cli 伴侣
【发布时间】:2020-06-29 12:04:31
【问题描述】:

我在 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,并且能够在登录到代理时运行它。

我该如何解决这个问题?

【问题讨论】:

  • "我在代理上安装了 newman 和 newman-reporter-html 并且能够在登录到代理时运行它。"我假设您在上面的句子中指的是您的自托管代理。你是用什么命令安装 newman 的?
  • npm install -g newmannpm install -g newman-reporter-html

标签: azure-devops postman azure-pipelines-release-pipeline azure-devops-pipelines


【解决方案1】:

解决我添加的问题

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'

我不确定为什么它没有找到已安装的版本本身。所以如果有人有想法,分享一下会很棒。

【讨论】:

    猜你喜欢
    • 2021-11-14
    • 1970-01-01
    • 2019-11-06
    • 1970-01-01
    • 2019-08-31
    • 2021-02-20
    • 1970-01-01
    • 1970-01-01
    • 2021-11-14
    相关资源
    最近更新 更多