【问题标题】:sync postman with azure devops将邮递员与 azure devops 同步
【发布时间】:2021-06-13 22:10:33
【问题描述】:

我可以在 azure devops 中成功运行邮递员测试有没有办法

  1. 创建一个存储库“MyCollection”
  2. 运行“Cron”管道,获取集合并将其保存到存储库?

任何建议

【问题讨论】:

    标签: postman azure-devops-rest-api


    【解决方案1】:

    勾选这个扩展Get Postman Scripts,默认它会下载你的邮递员json文件并保存到$(Build.ArtifactStagingDirectory),然后我们可以通过git cmd将文件推送到Azure DevOps repo。

    cd  $(Build.ArtifactStagingDirectory)
    git config --global user.name "{email}"
    git checkout master
    git add .
    git commit -m "Sync postman json file to Azure DevOps Repo"
    git push https://{PAT}@dev.azure.com/{org name}/{project name}/_git/{repo name}
    

    您也可以查看doc 了解更多详情。

    更新1

    YAML

    - task: oneLuckiGetPostmanScripts@1
      displayName: 'Get Postman Script'
      inputs:
        fileLocation: '$(Build.ArtifactStagingDirectory)\Postman'
        apiKey: '{key}'
    

    结果:

    【讨论】:

    • 非常感谢。刚看到这个。阅读并尝试看看我是否可以在任务中实现它
    • 感谢您的宝贵时间您知道是否可以知道要保存哪个集合吗?是否可以使用 newman 任务导出集合并将其保存到 repo ,在“没有打开这样的文件或目录”的情况下执行以下崩溃 - 任务:oneLuckiGetPostmanScripts@1 输入:fileLocation:'$(Build.ArtifactStagingDirectory)/Postman ' apiKey: '$(PostmanApiKey)' pauseDuration: '100' downloadEnvironments: false
    • 嗨@developer9969,我只有一个集合,它将josn 文件保存到我的repo。另外,你能在这里分享一下详细日志吗?根据错误信息,似乎找不到路径,我已经更新了答案,你可以检查一下,然后在这里分享结果。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-10-28
    • 1970-01-01
    • 2022-09-23
    • 2021-03-05
    • 2021-12-14
    • 2020-06-18
    • 1970-01-01
    相关资源
    最近更新 更多