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

{
    "fields": {
        "project": {
            "id": "10402"
        },
        "summary": "Test Execution for xunit Execution",
        "issuetype": {
            "id": "10007"
        },
        "components" : [
            {
            "name":"Interface"
            },
            {
            "name":"Core"
            }
        ]
    }
}
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":"12357",
      "key":"CALC-2177",
      "self":"http://www.example.com/rest/api/2/issue/12357"
   },
   "testIssues":{
      "success":[
         {
            "id":"12217",
            "key":"CALC-2097",
            "self":"http://www.example.com/rest/api/2/issue/12217"
         },
         {
            "id":"12214",
            "key":"CALC-2094",
            "self":"http://www.example.com/rest/api/2/issue/12214"
         },
         {
            "id":"12213",
            "key":"CALC-2093",
            "self":"http://www.example.com/rest/api/2/issue/12213"
         },
         {
            "id":"12216",
            "key":"CALC-2096",
            "self":"http://www.example.com/rest/api/2/issue/12216"
         },
         {
            "id":"12215",
            "key":"CALC-2095",
            "self":"http://www.example.com/rest/api/2/issue/12215"
         },
         {
            "id":"12210",
            "key":"CALC-2090",
            "self":"http://www.example.com/rest/api/2/issue/12210"
         },
         {
            "id":"12211",
            "key":"CALC-2091",
            "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.

...