Curl command line to import xml file to Xray

1k views Asked by At

Good afternoon,

I'm using robotframework to run some tests. After I run them I have an output.xml file with the results.

I searched ways to import these results to Xray and found these links: https://docs.getxray.app/display/XRAY/Testing+using+Robot+Framework+integration+in+Python+or+Java https://docs.getxray.app/display/XRAY/Import+Execution+Results+-+REST#ImportExecutionResultsREST-RobotFrameworkXMLresults

So I created a .sh file with this command line:

#!/bin/bash
 
PROJECT=myproject
TESTPLAN=mytestplan
 

curl -X POST -H "Content-Type: multipart/form-data" -u myuser:mypassword -F "file=output.xml" "https://myserver/rest/raven/1.0/import/execution/robot?projectKey=$PROJECT&testPlanKey=$TESTPLAN"

It displays this error '' Forbidden (403)''.

Do you know how to solve this?

1

There are 1 answers

0
Sérgio On

I guess you're using Xray on Jira server/Data Center and not Jira Cloud, correct? Is so, it should be something like:

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "[email protected]" "http://<jira_base_url>/rest/raven/1.0/import/execution/robot?projectKey=ROB&testPlanKey=ROB-12&testEnvironments=$BROWSER"

Note that sometimes <jira_base_url> is something like http://<some_ip>/jira .. is it your case perhaps?

Note: In this tutorial, you can find a concrete example for Xray on Jira server/DC. A similar tutorial for Xray on Jira Cloud can be found here.