【问题标题】:Import automated test results to Xray Cloud multipart using Azure Devops使用 Azure Devops 将自动化测试结果导入 Xray Cloud multipart
【发布时间】:2021-08-24 19:16:20
【问题描述】:

我正在尝试使用 Azure Devops 将结果导入 Xray Cloud multipart,这是来自 yml 配置文件的 bash 命令:

     token=$(curl -H "Content-Type: application/json" -X POST --data '{ "client_id": "$(client_id)","client_secret": "$(client_secret)" }' https://xray.cloud.xpand-it.com/api/v1/authenticate| tr -d '"')
     curl -H "Content-Type: multipart/form-data" -X POST -F info=@path\issueFields.json -F results=@path\target\surefire-reports\TEST-TestSuite.xml -F testInfo=@path\testIssueFields.json -H "Authorization: Bearer $token" https://xray.cloud.xpand-it.com/api/v1/import/execution/testng/multipart"

我每次都在管道控制台中收到此错误:

"curl: (26) Failed to open/read local data from file/application
##[error]Bash exited with code '26'."

我做错了什么?

bash 日志:

Starting: Bash
==============================================================================
Task         : Bash
Description  : Run a Bash script on macOS, Linux, or Windows
Version      : 3.189.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/bash
==============================================================================

【问题讨论】:

  • 您使用的是什么代理,托管代理?和 windows 代理或 Nexus?请在问题中分享调试日志。
  • 嗨@Leo,我在上面的问题中添加了调试日志

标签: java azure-devops testng multipart jira-xray


【解决方案1】:

如果您完全按照共享的方式使用命令,那么您必须有一个名为“path\issueFields.json”的文件。我猜“路径”不是真正的目录名。这同样适用于您识别的其他文件。 所以可能你的 curl 命令应该是这样的:

curl -H "Content-Type: multipart/form-data" -X POST -F info=@issueFields.json -F results=@./target/surefire-reports/TEST-TestSuite.xml -F testInfo=@testIssueFields.json -H "Authorization: Bearer $token" https://xray.cloud.xpand-it.com/api/v1/import/execution/testng/multipart"

【讨论】:

  • Sergio,“路径”是文件位置的绝对路径。我也完全按照你写的那样尝试了你的 curl 命令,但我得到了相同的结果:(
  • 你有所有这些文件吗?您是否也可以尝试在路径上替换 / 为 \,因为您似乎使用的是 Windows 系统?
  • 是的,json文件在根目录,xml文件在surefire-reports文件夹中
  • 在文件路径中替换 / 为 \ 没有成功?
  • 我已经把 / 换成了 \ 但还是不行
猜你喜欢
  • 2020-04-27
  • 1970-01-01
  • 1970-01-01
  • 2022-12-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多