【问题标题】:Postman tests hang when running from Azure DevOps从 Azure DevOps 运行时 Postman 测试挂起
【发布时间】:2025-07-05 21:45:02
【问题描述】:

从 Azure DevOps 运行 postman/newman 测试集合时,测试挂起。输出显示:

[debug]INPUT_SCRIPT: 'newman run CVueAPITests.postman_collection.json -k -e QME.postman_environment.json -d CVUEAPIAliveData_1.csv --reporters junit --reporter-junit-export Results\junitReport.xml'
[debug]INPUT_WORKINGDIRECTORY: 'D:\DEV_agent\_work\7\s\Postman\CVue'
[debug]Asserting container path exists: 'D:\DEV_agent\_work\7\s\Postman\CVue'
Generating script.
Script contents:
newman run CVueAPITests.postman_collection.json -k -e QME.postman_environment.json -d CVUEAPIAliveData_1.csv --reporters junit --reporter-junit-export Results\junitReport.xml
[debug]AGENT_VERSION: '2.149.2'
[debug]AGENT_TEMPDIRECTORY: 'D:\DEV_agent\_work\_temp'
[debug]Asserting container path exists: 'D:\DEV_agent\_work\_temp'
[debug]Asserting leaf path exists: 'C:\Windows\system32\cmd.exe'
========================== Starting Command Output ===========================
[debug]Entering Invoke-VstsTool.
[debug] Arguments: '/D /E:ON /V:OFF /S /C "CALL "D:\DEV_agent\_work\_temp\1c3a85e8-d01b-4df3-b6b0-322239c48093.cmd""'
[debug] FileName: 'C:\Windows\system32\cmd.exe'
[debug] WorkingDirectory: 'D:\DEV_agent\_work\7\s\Postman\CVue'
[command]"C:\Windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "D:\DEV_agent\_work\_temp\1c3a85e8-d01b-4df3-b6b0-322239c48093.cmd""

当我在构建服务器上本地执行这个完全相同的命令时,我运行测试集合没有问题:

newman run CVueAPITests.postman_collection.json -k -e QME.postman_environment.json -d CVUEAPIAliveData_1.csv --reporters junit --reporter-junit-export Results\junitReport.xml

【问题讨论】:

  • 您好,您的问题进展如何?如果您有任何问题,请随时提问。

标签: azure-devops postman-collection-runner


【解决方案1】:

我按照这个blog测试了一下,终于可以顺利拿到测试结果了。您可以参考它的详细指南。

这里我给出一个详细的配置,你可以看看和你的有什么不同。希望可以帮助到你。

【讨论】:

  • 我最初关注了同一个博客,但仍然没有骰子。我已尝试将“cli”添加/删除到 --reporters 标志,但似乎没有启动测试,因为没有任何内容报告回“运行 API 测试”构建步骤控制台日志。
  • 您使用私人代理。可以到本地s文件夹下的Results文件夹查看是否有生成junitReport.xml文件。
最近更新 更多