Versions Compared

Key

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

...

Xray JSON format

/rest/raven/1.0/import/execution

Xray JSON format multipart/rest/raven/1.0/import/execution/multipart
Cucumber JSON output format

/rest/raven/1.0/import/execution/cucumber

Cucumber JSON output format multipart

/rest/raven/1.0/import/execution/cucumber/multipart

Behave JSON output format

/rest/raven/1.0/import/execution/behave

Behave JSON output format multipart

/rest/raven/1.0/import/execution/behave/multipart

JUnit XML output format/rest/raven/1.0/import/execution/junit
JUnit XML output format multipart/rest/raven/1.0/import/execution/junit/multipart
TestNG XML output format/rest/raven/1.0/import/execution/testng
TestNG XML output format multipart/rest/raven/1.0/import/execution/testng/multipart
NUnit XML output format/rest/raven/1.0/import/execution/nunit
NUnit XML output format multipart/rest/raven/1.0/import/execution/nunit/multipart
XUnit xUnit XML output format/rest/raven/1.0/import/execution/xunit
XUnit xUnit XML output format multipart/rest/raven/1.0/import/execution/xunit/multipart
Robot Framework XML output format/rest/raven/1.0/import/execution/robot
Robot Framework XML output format multipart/rest/raven/1.0/import/execution/robot/multipart
Compressed .zip file (e.g., Calabash execution results)

/rest/raven/1.0/import/execution/bundle

...

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

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

Request

QUERY PARAMETERS
parametertypedescription
projectKeyString

- key of the project where the test execution (if the testExecKey parameter wasn't provided) and the tests (if they aren't created yet) are going to be created.

testExecKeyString- key of the Test Execution.
testPlanKeyString- key of the Test Plan; if you specify the Test Plan, the Tests will be added automatically to the Test Plan if they're not part of it.
testEnvironmentsString- a string containing a list of test environments separated by ";"
revisionString- source code and documentation version used in the test execution.
fixVersionString

- the Fix Version associated with the test execution (it supports only one value).

multipart/form-data:

"file" : a MultipartFormParam containing a XML file to import.

Example

Code Block
titleJUnit Report XML
<?xml version="1.0" encoding="UTF-8" ?>
<testsuite tests="15" failures="0" name="ut.com.xpandit.raven.service.impl.IssueDataSetTest" time="0.163" errors="0" skipped="0">
  <properties>
    ...
  </properties>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidLimitOverflowOption_returnsExpectedSubset" time="0.114"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withNullOptionsAndValidIssue_throwsIllegalArgumentException" time="0.002"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidEmptyOptions_returnsAllIssues" time="0.002"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidGlobalSearchOptions_returnsExpectedTests" time="0.016"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndInvalidColumnSearchOption_returnsAllTests" time="0.007"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidLimitUnderOption_returnsExpectedSubset" time="0.001"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidGlobalSearchOptionThatMachesIssueKey_returnsExpectedTestWithMatchedKey" time="0.006"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidSummaryColumnAscSortOption_returnsExpectedIssuesInAscOrder" time="0.006"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidSummaryColumnDescSortOption_returnsExpectedIssuesInDescOrder" time="0.002"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidGlobalSearchOptionThatMatchesAllElements_returnsAllTests" time="0.001"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidColumnSearchOptionThatMatchesOneElement_returnsOneTest" time="0.002"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidColumnSearchOptionThatMatchesNoIssue_returnsEmptyList" time="0.001"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidGlobalSearchOptionThatMachesNoIssue_returnsEmptyList" time="0.001"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidKeyColumnDescSortOption_returnsExpectedIssuesInDescOrder" time="0.001"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidKeyColumnAscSortOption_returnsExpectedIssuesInAscOrder" time="0.001"/>
</testsuite>
Tip
titleExample Request

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@report.xml" http://yourserver/rest/raven/1.0/import/execution/junit?projectKey=XTP

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@report.xml" http://yourserver/rest/raven/1.0/import/execution/junit?testExecKey=XNP-23

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@report.xml" http://yourserver/rest/raven/1.0/import/execution/junit?projectKey=XTP&testExecKey=XNP-23

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@report.xml" http://yourserver/rest/raven/1.0/import/execution/junit?projectKey=XTP&testPlanKey=XTP-12&revision=v2.1.0

Responses

200 OK : application/json : Successful. The results where successfully imported to Jira.

Code Block
titleExample Output
{
  "testExecIssue": {
    "id": "10200",
    "key": "XNP-24",
    "self": "http://www.example.com/jira/rest/api/2/issue/10200"
  }
}

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.

...

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

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

Note: Currently, if you specify the Test Plan custom field, the Tests of the Test Execution will not be added automatically to the Test Plan.

Request

Example

Code Block
titleJUnit Report XML
<?xml version="1.0" encoding="UTF-8" ?>
<testsuite tests="15" failures="0" name="ut.com.xpandit.raven.service.impl.IssueDataSetTest" time="0.163" errors="0" skipped="0">
  <properties>
    ...
  </properties>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidLimitOverflowOption_returnsExpectedSubset" time="0.114"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withNullOptionsAndValidIssue_throwsIllegalArgumentException" time="0.002"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidEmptyOptions_returnsAllIssues" time="0.002"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidGlobalSearchOptions_returnsExpectedTests" time="0.016"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndInvalidColumnSearchOption_returnsAllTests" time="0.007"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidLimitUnderOption_returnsExpectedSubset" time="0.001"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidGlobalSearchOptionThatMachesIssueKey_returnsExpectedTestWithMatchedKey" time="0.006"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidSummaryColumnAscSortOption_returnsExpectedIssuesInAscOrder" time="0.006"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidSummaryColumnDescSortOption_returnsExpectedIssuesInDescOrder" time="0.002"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidGlobalSearchOptionThatMatchesAllElements_returnsAllTests" time="0.001"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidColumnSearchOptionThatMatchesOneElement_returnsOneTest" time="0.002"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidColumnSearchOptionThatMatchesNoIssue_returnsEmptyList" time="0.001"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidGlobalSearchOptionThatMachesNoIssue_returnsEmptyList" time="0.001"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidKeyColumnDescSortOption_returnsExpectedIssuesInDescOrder" time="0.001"/>
  <testcase classname="ut.com.xpandit.raven.service.impl.IssueDataSetTest" name="testApplyOptions_withValidIssueAndValidKeyColumnAscSortOption_returnsExpectedIssuesInAscOrder" time="0.001"/>
</testsuite>


Code Block
titleTest Exec Info JSON
{
	"fields": {
		"project": {
			"id": "10402"
		},
		"summary": "Test Execution for junit 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/junit/multipart

Responses

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

Code Block
titleExample Output
{
  "testExecIssue": {
    "id": "10200",
    "key": "XNP-24",
    "self": "http://www.example.com/jira/rest/api/2/issue/10200"
  },
  "testIssues": {
        "success": [
            {
                "self": "http://localhost:8080/rest/api/2/issue/10201",
                "id": "10201",
                "key": "XNP-25"
            },
            {
                "self": "http://localhost:8080/rest/api/2/issue/10202",
                "id": "10202",
                "key": "XNP-26"
            }
        ]
    }
}

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": "ut.com.xpandit.raven.service.impl.IssueDataSetTest.testApplyOptions_withNullOptionsAndValidIssue_throwsIllegalArgumentException"
            }
        ]
    }
}

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.

...

Expand
titlePOST /rest/raven/1.0/import/execution/xunit
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

QUERY PARAMETERS
parametertypedescription
projectKeyString- key of the project where the Test Execution (if the testExecKey parameter wasn't provided) and the tests (if they aren't created yet) are going to be created.
testExecKeyString- key of the Test Execution.
testPlanKeyString- key of the Test Plan; if you specify the Test Plan, the Tests will be added automatically to the Test Plan if they're not part of it.
testEnvironmentsString- a string containing a list of test environments separated by ";"
revisionString- source code and documentation version used in the test execution.
fixVersionString- the Fix Version associated with the test execution (it supports only one value).

multipart/form-data:

"file" : a MultipartFormParam containing a XML file to import.

Example

Code Block
titlexUnit Report XML
<?xml version="1.0" encoding="utf-8"?>
<assemblies timestamp="0708/3110/20182020 14:5859:4844">
    <assembly name="C:\Users\smsf\Documents\Visual Studio 2015\Projects\xUnitDemo\xUnitDemo\bin\Debug\xUnitDemo.DLL" environment="64-bit .NET 4.0.30319.42000 [collection-per-class, parallel (1 threads)]" test-framework="xUnit.net 2.3.1.3858/Users/Projects/OurXunitTestsProject/OurXunitTestsProject/bin/Debug/netcoreapp3.1/OurXunitTestsProject.dll" run-date="20182020-0708-3110" run-time="14:58:47" config-file="C:\Users\smsf\Documents\Visual Studio 2015\Projects\xUnitDemo\packages\xunit.runner.console.2.4.0\tools\net452\xunit.console.exe.Config59:44" total="159" passed="145" failed="13" skipped="01" time="023.257519" errors="0">
        <errors />
        <collection total="21" passed="10" failed="10" skipped="01" name="Test collection for xUnitDemoOurXunitTestsProject.SimpleTestsOurSkippableClass" time="0.070001">
            <test name="xUnitDemoOurXunitTestsProject.SimpleTestsOurSkippableClass.PassingTestAddTwoPlusTwo_EqualsFour" type="xUnitDemoOurXunitTestsProject.SimpleTestsOurSkippableClass" method="PassingTestAddTwoPlusTwo_EqualsFour" time="0.06367410010000" result="PassSkip">
        <output>The calculation is wrong. It'll be fixed  <traits>
later.
</output>
        <traits />
      </test>
    </collection>
    <trait<collection nametotal="test2" valuepassed="CALC-1" />
      failed="1" skipped="0" name="Test collection for OurXunitTestsProject.OurTestClass" time="0.009">
      <test name="OurXunitTestsProject.OurTestClass.AddTwoPlusThree_EqualsFive" type="OurXunitTestsProject.OurTestClass"      <trait name="requirement" value="CALC-1" /method="AddTwoPlusThree_EqualsFive" time="0.0077767" result="Fail">
        <failure>
          <message>Assert.Equal()  <trait name="labels" value="core UI" />Failure
Expected: 5
Actual:   6</message>
          <stack-trace>   at OurXunitTestsProject.OurTestClass.AddTwoPlusThree_EqualsFive() in  </traits>/Users/Projects/OurXunitTestsProject/OurXunitTestsProject/OurTestClass.cs:line 19</stack-trace>
        </failure>
        <traits </test>>
      </test>
      <test name="xUnitDemoOurXunitTestsProject.SimpleTestsOurTestClass.FailingTestAddTwoPlusTwo_EqualsFour" type="xUnitDemoOurXunitTestsProject.SimpleTestsOurTestClass" method="FailingTestAddTwoPlusTwo_EqualsFour" time="0.00594740010802" result="FailPass">
        <traits />
      </test>
  <failure exception-type="Xunit.Sdk.EqualException">  </collection>
    <collection total="4" passed="3" failed="1" skipped="0" name="Test collection for OurXunitTestsProject.OurTheoryClass" time="6.005">
       <message><![CDATA[Assert.Equal() Failure\r\nExpected: 5\r\nActual: 4]]></message>
    <test name="OurXunitTestsProject.OurTheoryClass.SumTwoNumbers(value1: -2, value2: 3, expected: 0)" type="OurXunitTestsProject.OurTheoryClass" method="SumTwoNumbers" time="1.5030442" result="Fail">
        <failure>
        <stack-trace><![CDATA[ at xUnitDemo<message>Assert.SimpleTests.FailingTestEqual() in C:\Users\smsf\documents\visual studio 2015\Projects\xUnitDemo\xUnitDemo\SimpleTests.cs:line 30]]></stack-trace>Failure
Expected: 0
Actual:   1</message>
          <stack-trace>   at OurXunitTestsProject.OurTheoryClass.SumTwoNumbers(Int32  </failure>
    value1, Int32 value2, Int32 expected) in /Users/Projects/OurXunitTestsProject/OurXunitTestsProject/OurTheoryClass.cs:line 21</stack-trace>
        </test>failure>
        </collection><traits>
        <collection total="13" passed="13" failed="0" skipped="0" <trait name="Test collection for xUnitDemo.CalculatorTestsrequirement" timevalue="0.001"CALC-2088" />
          <trait  <test name="xUnitDemo.CalculatorTests.CanAddTheoryClassData(value1: 1, value2: 2, expected: 3)" type="xUnitDemo.CalculatorTests" method="CanAddTheoryClassData" time="0.0002722" result="Pass" />name="labels" value="calculator theory" />
        </traits>
      </test>
      <test name="xUnitDemoOurXunitTestsProject.CalculatorTestsOurTheoryClass.CanAddTheoryClassDataSumTwoNumbers(value1: -42147483648, value2: -61, expected: -102147483647)" type="xUnitDemoOurXunitTestsProject.CalculatorTestsOurTheoryClass" method="CanAddTheoryClassDataSumTwoNumbers" time="01.00002485005778" result="Pass" />
        <traits>
     <test     <trait name="xUnitDemo.CalculatorTests.CanAddTheoryClassData(value1: -2, value2: 2, expected: 0)" type="xUnitDemo.CalculatorTests" method="CanAddTheoryClassData" time="0.0000028" result="Pass"requirement" value="CALC-2088" />
          <trait name="labels" value="calculator theory" />
        </traits>
      </test>
      <test name="xUnitDemoOurXunitTestsProject.CalculatorTestsOurTheoryClass.CanAddTheoryClassDataSumTwoNumbers(value1: -21474836481, value2: -12, expected: 21474836473)" type="xUnitDemoOurXunitTestsProject.CalculatorTestsOurTheoryClass" method="CanAddTheoryClassDataSumTwoNumbers" time="01.00000175002999" result="Pass" />
        <traits>
    <test name="xUnitDemo.CalculatorTests.CanAddTheoryMemberDataMethod(value1: 1, value2: 2, expected: 3)"<trait typename="xUnitDemo.CalculatorTestsrequirement" methodvalue="CanAddTheoryMemberDataMethod" time="0.0001179" result="PassCALC-2088" />
          <trait name="labels" value="calculator theory" />
        </traits>
      </test>
      <test name="xUnitDemoOurXunitTestsProject.CalculatorTestsOurTheoryClass.CanAddTheoryMemberDataMethodSumTwoNumbers(value1: -4, value2: -6, expected: -10)" type="xUnitDemoOurXunitTestsProject.CalculatorTestsOurTheoryClass" method="CanAddTheoryMemberDataMethodSumTwoNumbers" time="01.00000545013213" result="Pass" />
        <traits>
    <test name="xUnitDemo.CalculatorTests.CanAddTheoryMemberDataMethod(value1: -2, value2: 2, expected: 0)"<trait typename="xUnitDemo.CalculatorTestsrequirement" methodvalue="CanAddTheoryMemberDataMethod" time="0.0000024" result="PassCALC-2088" />
          <trait name="labels" value="calculator theory" />
        </traits>
    <test name="xUnitDemo.CalculatorTests.PassingTest" type="xUnitDemo.CalculatorTests" method="PassingTest" time="0.0000952" result="Pass" />
     </test>
    </collection>
    <collection total="2" passed="1" failed="1" skipped="0" name="Test collection for OurXunitTestsProject.OurTraitsClass" time="17.504">
        <test name="xUnitDemoOurXunitTestsProject.CalculatorTests.CanAddTheory(value1: 1, value2: 2, expected: 3)OurTraitsClass.AddTwoPlusFour_EqualsSix" type="xUnitDemoOurXunitTestsProject.CalculatorTestsOurTraitsClass" method="CanAddTheoryAddTwoPlusFour_EqualsSix" time="010.00010950027784" result="Pass" />
        <traits>
    <test name="xUnitDemo.CalculatorTests.CanAddTheory(value1: -4, value2: -6, expected: -10)" type="xUnitDemo.CalculatorTests" method="CanAddTheory" time="0.0000083" result="Pass <trait name="test" value="CALC-2114" />
          <trait name="requirement" value="CALC-2088" />
          <trait  <test name="xUnitDemo.CalculatorTests.CanAddTheory(value1: -2, value2: 2, expected: 0)" type="xUnitDemo.CalculatorTests" method="CanAddTheory" time="0.000002" result="Pass" />name="labels" value="calculator sum core" />
        </traits>
      </test>
      <test name="xUnitDemoOurXunitTestsProject.CalculatorTests.CanAddTheory(value1: -2147483648, value2: -1, expected: 2147483647)OurTraitsClass.AddTwoPlusFive_EqualsSeven" type="xUnitDemoOurXunitTestsProject.CalculatorTestsOurTraitsClass" method="CanAddTheoryAddTwoPlusFive_EqualsSeven" time="07.00000175012751" result="PassFail" />
        <failure>
          <message>Assert.Equal() Failure
Expected: 7
Actual:   8</message>
  <test name="xUnitDemo.CalculatorTests.SkippedTest" type="xUnitDemo.CalculatorTests" method="SkippedTest" time="" result="Skip">        <stack-trace>   at OurXunitTestsProject.OurTraitsClass.AddTwoPlusFive_EqualsSeven() in /Users/Projects/OurXunitTestsProject/OurXunitTestsProject/OurTraitsClass.cs:line 29</stack-trace>
        </failure>
        <traits>
        <reason><![CDATA[this test was skipped]]></reason>
    <trait name="labels" value="calculator sum core" />
        </test>traits>
      </test>
    </collection>
    </assembly>
</assemblies>


Tip
titleExample Request

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@report.xml" http://yourserver/rest/raven/1.0/import/execution/xunit?projectKey=XTP

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@report.xml" http://yourserver/rest/raven/1.0/import/execution/xunit?testExecKey=XNP-23

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@report.xml" http://yourserver/rest/raven/1.0/import/execution/xunit?projectKey=XTP&testExecKey=XNP-23

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@report.xml" http://yourserver/rest/raven/1.0/import/execution/xunit?projectKey=XTP&testPlanKey=XTP-12&revision=v2.1.0

Responses

200 OK : application/json : Successful. The results where were successfully imported to Jira.

Code Block
titleExample Output
{
   "testExecIssue": {
      "id": "1020012354",
      "key": "XNPCALC-242174",
      "self": "http://www.example.com/jira/rest/api/2/issue/1020012354"
   },
   "testIssues": {
        "success": [[
         {
            {"id":"12302",
            "key":"CALC-2122",
            "self": "http://localhost:8080www.example.com/rest/api/2/issue/1020112302",
         },
       "id": "10201",  {
                "keyid": "XNP-2512312",
            }"key":"CALC-2132",
            {
        "self":"http://www.example.com/rest/api/2/issue/12312"
         },
         {
            "id":"12301",
            "key":"CALC-2121",
            "self": "http://localhost:8080www.example.com/rest/api/2/issue/10202"12301"
         },
         {
            "id": "1020212314",
            "key":"CALC-2134",
            "keyself": "XNP-26"http://www.example.com/rest/api/2/issue/12314"
         },
     }
    {
            ]"id":"12242",
    }
}

400 BAD_REQUEST : application/json : Returns the error.

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

        "key":"CALC-2114",
            "self":"http://www.example.com/rest/api/2/issue/12242"
         },
         {
            "id":"12305",
            "key":"CALC-2125",
            "self":"http://www.example.com/rest/api/2/issue/12305"
         }
      ]
   }
}

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 500  INTERNAL SERVER ERROR : application/json : An internal error occurred when importing execution results.

xUnit XML results Multipart

...

Expand
titlePOST /rest/raven/1.0/import/execution/nunitxunit/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="utfUTF-8"?>
<assemblies timestamp="07/31/2018 14:58:48">
    <assembly name="C:\Users\smsf\Documents\Visual Studio 2015\Projects\xUnitDemo\xUnitDemo\bin\Debug\xUnitDemo.DLL" environment="64-bit .NET 4.0.30319.42000 [collection-per-class, parallel (1 threads)]" test-framework="xUnit.net 2.3.1.3858/Users/Projects/OurXunitTestsProject/OurXunitTestsProject/bin/Debug/netcoreapp3.1/OurXunitTestsProject.dll" run-date="20182020-0708-3110" run-time="1415:58:47" config-file="C:\Users\smsf\Documents\Visual Studio 2015\Projects\xUnitDemo\packages\xunit.runner.console.2.4.0\tools\net452\xunit.console.exe.Config" 04:09" total="15" passed="14" failed="1" skipped="0" time="0.257007" 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="0112121210.06367416636741" result="Pass">
                <traits>
                    <trait name="test" value="CALC-1" />
                    <trait name="requirement" value="CALC-1" />
                    <trait name="labels" value="core UI" />
                </traits>
            </test>
            <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.SkippedTestFailingTest" type="xUnitDemo.CalculatorTests" method="SkippedTestFailingTest" time="0.0000915" result="Skip">
                <reason><![CDATA[this test was skipped]]></reason>
            </test>Pass" />
        </collection>
    </assembly>
</assemblies>
Code Block
titleTest Exec Info JSON
{
	    "fields": {
		        "project": {
			            "id": "10402"
		        },
		        "summary": "Test Execution for nunitxunit Execution",
		        "issuetype": {
			            "id": "10007"
		        },
		        "components" : [
			{
			            {
            "name":"Interface"
			},
			{
			            },
            {
            "name":"Core"
            }
        ]
    }
}
Code Block
titleTest Info JSON
{
    "fields": {
        "description": "Automated Test",
			}
		]
	}
}
Code Block
titleTest Info JSON
        "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"
         },
        {
    "fields": {
            "descriptionid": "Automated Test12214",
            "priority" : {
"key":"CALC-2094",
            	"idself": "10"http://www.example.com/rest/api/2/issue/12214"
         },   
        "labels": [{
            "Testingid":"12213",
            "Automation""key":"CALC-2093",
        ]
    }
}
Tip
titleExample Request
Code Block
titleExample Output
curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@report.xml" -F "info=@testExec.json" -F "testInfo=@test.json" 
"self":"http://
yourserver
www.example.com/rest/
raven
api/
1.0
2/
import/execution/xunit/multipart

Responses

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

{
  "testExecIssue": {
issue/12213"
         },
         {
            "id":"12216",
            "idkey": "10200CALC-2096",
       "key": "XNP-24",
    "self": "http://www.example.com/jira/rest/api/2/issue/1020012216"
         },
      "testIssues":   {
            "successid": ["12215",
            {"key":"CALC-2095",
                "self": "http://localhost:8080www.example.com/rest/api/2/issue/1020112215",
         },
       "id": "10201",
    {
              "keyid": "XNP-2512210",
            },
            {
 "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.

...

Whenever importing results from some frameworks (i.e. JUnit, TestNG, NUnit, Robot framework), Xray can identify the automated test from the report/results file, based on an hardcoded criteria (such as the class name plus the class method corresponding to the automated test). However, depending

For example, in JUnit the classname and name properties of a testcase are concatenated. If no classname is provided then it is replaced by the the testsuite name and the result will be the concatenation of the testsuite name and testcase name. This value becomes the Definition of the Generic Test to where the results are mapped.

Depending on the test automation framework, it's possible to specify the Test issue key to which report the results in the test's code.

...