Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titlePOST /rest/raven/1.0/import/execution/xunit/multipart
Panel
borderColor#ccc
borderStylesolid

Import the execution results created with the xUnit XML output formatter. For more information please check the documentation about xUnit integration.

Request

Example

Code Block
titlexUnit Report XML
<?xml version="1.0" encoding="UTF-8"?>
<assemblies timestamp="07/31/2018 14:58:48">
<assembly name="/Users/Projects/OurXunitTestsProject/OurXunitTestsProject/bin/Debug/netcoreapp3.1/OurXunitTestsProject.dll" run-date="2020-08-10" run-time="15:04:09" total="15" passed="14" failed="1" skipped="0" time="0.007" errors="0">
<errors />
<collection total="2" passed="1" failed="1" skipped="0" name="Test collection for xUnitDemo.SimpleTests" time="0.070">
<test name="xUnitDemo.SimpleTests.PassingTest" type="xUnitDemo.SimpleTests" method="PassingTest" time="112121210.6636741" result="Pass" />
<test name="xUnitDemo.SimpleTests.FailingTest" type="xUnitDemo.SimpleTests" method="FailingTest" time="0.0059474" result="Fail">
<failure exception-type="Xunit.Sdk.EqualException">
<message><![CDATA[Assert.Equal() Failure\r\nExpected: 5\r\nActual: 4]]></message>
<stack-trace><![CDATA[at xUnitDemo.SimpleTests.FailingTest() in C:\Users\smsf\documents\visual studio 2015\Projects\xUnitDemo\xUnitDemo\SimpleTests.cs:line 30]]></stack-trace>
</failure>
</test>
</collection>
<collection total="13" passed="13" failed="0" skipped="0" name="Test collection for xUnitDemo.CalculatorTests" time="0.001">
<test name="xUnitDemo.CalculatorTests.CanAddTheoryClassData(value1: 1, value2: 2, expected: 3)" type="xUnitDemo.CalculatorTests" method="CanAddTheoryClassData" time="0.0002722" result="Pass" />
<test name="xUnitDemo.CalculatorTests.CanAddTheoryClassData(value1: -4, value2: -6, expected: -10)" type="xUnitDemo.CalculatorTests" method="CanAddTheoryClassData" time="0.0000248" result="Pass" />
<test name="xUnitDemo.CalculatorTests.CanAddTheoryClassData(value1: -2, value2: 2, expected: 0)" type="xUnitDemo.CalculatorTests" method="CanAddTheoryClassData" time="0.0000028" result="Pass" />
<test name="xUnitDemo.CalculatorTests.CanAddTheoryClassData(value1: -2147483648, value2: -1, expected: 2147483647)" type="xUnitDemo.CalculatorTests" method="CanAddTheoryClassData" time="0.0000017" result="Pass" />
<test name="xUnitDemo.CalculatorTests.CanAddTheoryMemberDataMethod(value1: 1, value2: 2, expected: 3)" type="xUnitDemo.CalculatorTests" method="CanAddTheoryMemberDataMethod" time="0.0001179" result="Pass" />
<test name="xUnitDemo.CalculatorTests.CanAddTheoryMemberDataMethod(value1: -4, value2: -6, expected: -10)" type="xUnitDemo.CalculatorTests" method="CanAddTheoryMemberDataMethod" time="0.0000054" result="Pass" />
<test name="xUnitDemo.CalculatorTests.CanAddTheoryMemberDataMethod(value1: -2, value2: 2, expected: 0)" type="xUnitDemo.CalculatorTests" method="CanAddTheoryMemberDataMethod" time="0.0000024" result="Pass" />
<test name="xUnitDemo.CalculatorTests.PassingTest" type="xUnitDemo.CalculatorTests" method="PassingTest" time="0.0000952" result="Pass" />
<test name="xUnitDemo.CalculatorTests.CanAddTheory(value1: 1, value2: 2, expected: 3)" type="xUnitDemo.CalculatorTests" method="CanAddTheory" time="0.0001095" result="Pass" />
<test name="xUnitDemo.CalculatorTests.CanAddTheory(value1: -4, value2: -6, expected: -10)" type="xUnitDemo.CalculatorTests" method="CanAddTheory" time="0.0000083" result="Pass" />
<test name="xUnitDemo.CalculatorTests.CanAddTheory(value1: -2, value2: 2, expected: 0)" type="xUnitDemo.CalculatorTests" method="CanAddTheory" time="0.000002" result="Pass" />
<test name="xUnitDemo.CalculatorTests.CanAddTheory(value1: -2147483648, value2: -1, expected: 2147483647)" type="xUnitDemo.CalculatorTests" method="CanAddTheory" time="0.0000017" result="Pass" />
<test name="xUnitDemo.CalculatorTests.FailingTest" type="xUnitDemo.CalculatorTests" method="FailingTest" time="0.0000915" result="Pass" />
</collection>
</assembly>
</assemblies>
Code Block
titleTest Exec Info JSON

{
    "testExecIssuefields": {
        "idproject":"12357", {
      "key":"CALC-2177",
      "selfid":"http://www.example.com/rest/api/2/issue/12357 "10402"
        },
        "testIssuessummary":{
 "Test Execution for xunit  "success":[Execution",
        "issuetype": {
            "id": "1221710007",
        },
    "key":"CALC-2097",
    "components" : [
      "self":"http://www.example.com/rest/api/2/issue/12217"
      {
   },
         {"name":"Interface"
            "id":"12214"},
            "key":"CALC-2094",{
            "selfname":"http://www.example.com/rest/api/2/issue/12214Core"
            },
        ]
    }
}
Code Block
titleTest Info JSON
{
    "fields": {
        "iddescription": "12213Automated Test",
            "keypriority":"CALC-2093", : {
            "self	"id":"http://www.example.com/rest/api/2/issue/12213 "10"
         },   
        "labels": {[
            "id":Testing"12216",
            "key":"CALC-2096",
Automation"
        ]
    }
}


Tip
titleExample Request

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@report.xml" -F "info=@testExec.json" -F "testInfo=@test.json" http://yourserver/rest/raven/1.0/import/execution/xunit/multipart

Responses

200 OK : application/json : Successful. The results were successfully imported to Jira. The following Test issues were also created with success.

Code Block
titleExample Output
{
   "testExecIssue":{
 "self":"http://www.example.com/rest/api/2/issue/12216"
         },
         {
            "id":"1221512357",
            "key":"CALC-20952177",
            "self":"http://www.example.com/rest/api/2/issue/1221512357"
   },
   "testIssues":{
   },   "success":[
         {
            "id":"1221012217",
            "key":"CALC-20902097",
            "self":"http://www.example.com/rest/api/2/issue/1221012217"
         },
         {
            "id":"1221112214",
            "key":"CALC-20912094",
            "self":"http://www.example.com/rest/api/2/issue/1221112214"
         }
      ]
   }
}
Code Block
titleTest Info JSON
{
    "fields": {
        "description": "Automated Test",
        "priority" : {
        	"id": "10"
        },   
        "labels": [
            "Testing",
            "Automation"
        ]
    }
}
Tip
titleExample Request

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@report.xml" -F "info=@testExec.json" -F "testInfo=@test.json" http://yourserver/rest/raven/1.0/import/execution/xunit/multipart

Responses

200 OK : application/json : Successful. The results were successfully imported to Jira. The following Test issues were also created with success.

Code Block
titleExample Output
{
  "testExecIssue": {
   {
            "id": "1020012213",
            "key": "XNPCALC-242093",
            "self": "http://www.example.com/jira/rest/api/2/issue/1020012213"
         },
   "testIssues":      {
            "successid": ["12216",
            {
    "key":"CALC-2096",
            "self": "http://localhost:8080www.example.com/rest/api/2/issue/10201",
12216"
         },
         {
            "id": "1020112215",
            "key":"CALC-2095",
     "key       "self": "XNP-25"
"http://www.example.com/rest/api/2/issue/12215"
         },
       },  {
            {"id":"12210",
            "key":"CALC-2090",
            "self": "http://localhost:8080www.example.com/rest/api/2/issue/10202"12210"
         },
         {
            "id": "1020212211",
                "key": "XNPCALC-262091",
            }
"self":"http://www.example.com/rest/api/2/issue/12211"
         }
      ]
    }
}

200 OK : application/json: Some results where successfully imported to Jira. But the following Test issues failed to be created due to the following reasons.

Code Block
titleExample Output
{
  "testExecIssue": {
    "id": "10200",
    "key": "XNP-24",
    "self": "http://www.example.com/jira/rest/api/2/issue/10200"
  },
  "testIssues": {
        "error": [
            {
                "messages": [
                    "Field 'customfield_10005' cannot be set. It is not on the appropriate screen, or unknown."
                ],
                "testDefinition": "x.CalculatorTests.CanMultiply"
            }
        ]
    }
}

400 BAD_REQUEST : application/json : Returns the error.

401 UNAUTHORIZED : application/json : The Xray license is not valid.

500  INTERNAL SERVER ERROR : application/json : An internal error occurred when importing execution results.

...