Skip to content
Advertisement

Import automated test results to Xray Cloud multipart using Azure Devops

I am trying to import results to Xray Cloud multipart using Azure Devops, this is my bash command from the yml configuration file:

     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=@pathissueFields.json -F results=@pathtargetsurefire-reportsTEST-TestSuite.xml -F testInfo=@pathtestIssueFields.json -H "Authorization: Bearer $token" https://xray.cloud.xpand-it.com/api/v1/import/execution/testng/multipart"

I am receiving this error everytime in the pipeline console:

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

What am I doing wrong?

The bash log:

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
==============================================================================

Advertisement

Answer

If you used the commands exactly as you shared then you must have a file named “pathissueFields.json”. I guess that “path” is not a real directory name. The same applies to other files you identify. So probably your curl command should be just something like:

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"
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement