Versions Compared

Key

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

...

Xray provides another endpoint if you want to create new Test Executions and have control over newly-created Test Execution Execution and Test fields. It allows you to send one XML file (the TestNG report) and a two JSON files similar to the one Jira uses to create new issues. For more information about that second format, check the Jira documentation here.

As of the creation of Test issues, some field values in the JSON file for Test Issue creation will follow some rules:

  • Issue Type: Overridden by the Test issue type;
  • Summary: Overridden by the internally generated summary;
  • Parent: This field is ignored;
  • Generic Test Definition: Not allowed to provide a value for this field.


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

Import the execution results created with the NUnit XML output formatter. For more information please check the documentation about TestNG 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
languagexml
titleTestNG XML Report
<?xml version="1.0" encoding="UTF-8"?>
<testng-results skipped="0" failed="2" ignored="0" total="8" passed="6">
  <reporter-output>
  </reporter-output>
  <suite name="TestAll" duration-ms="33" started-at="2018-03-06T11:53:00Z" finished-at="2018-03-06T11:53:00Z">
    <groups>
    </groups>
    <test name="calculator" duration-ms="33" started-at="2018-03-06T11:53:00Z" finished-at="2018-03-06T11:53:00Z">
      <class name="com.xpand.java.CalcTest">
        <test-method status="PASS" signature="setUp()[pri:0, instance:com.xpand.java.CalcTest@36d4b5c]" name="setUp" is-config="true" duration-ms="9" started-at="2018-03-06T11:53:00Z" finished-at="2018-03-06T11:53:00Z">
          <reporter-output>
          </reporter-output>
        </test-method> <!-- setUp -->
        <test-method status="PASS" signature="CanAddNumbers()[pri:0, instance:com.xpand.java.CalcTest@36d4b5c]" name="CanAddNumbers" duration-ms="2" started-at="2018-03-06T11:53:00Z" finished-at="2018-03-06T11:53:00Z">
          <reporter-output>
          </reporter-output>
          <attributes>
            <attribute name="test">
              <![CDATA[]]>
            </attribute> <!-- test -->
            <attribute name="requirement">
              <![CDATA[CALC-1235]]>
            </attribute> <!-- requirement -->
            <attribute name="labels">
              <![CDATA[core]]>
            </attribute> <!-- labels -->
          </attributes>
        </test-method> <!-- CanAddNumbers -->
        <test-method status="PASS" signature="CanAddNumbersFromGivenData(int, int, int)[pri:0, instance:com.xpand.java.CalcTest@36d4b5c]" name="CanAddNumbersFromGivenData" duration-ms="0" started-at="2018-03-06T11:53:00Z" data-provider="ValidDataProvider" finished-at="2018-03-06T11:53:00Z">
          <params>
            <param index="0">
              <value>
                <![CDATA[1]]>
              </value>
            </param>
            <param index="1">
              <value>
                <![CDATA[2]]>
              </value>
            </param>
            <param index="2">
              <value>
                <![CDATA[3]]>
              </value>
            </param>
          </params>
          <reporter-output>
          </reporter-output>
          <attributes>
            <attribute name="test">
              <![CDATA[]]>
            </attribute> <!-- test -->
            <attribute name="requirement">
              <![CDATA[CALC-1235]]>
            </attribute> <!-- requirement -->
            <attribute name="labels">
              <![CDATA[core]]>
            </attribute> <!-- labels -->
          </attributes>
        </test-method> <!-- CanAddNumbersFromGivenData -->
        <test-method status="FAIL" signature="CanAddNumbersFromGivenData(int, int, int)[pri:0, instance:com.xpand.java.CalcTest@36d4b5c]" name="CanAddNumbersFromGivenData" duration-ms="1" started-at="2018-03-06T11:53:00Z" data-provider="ValidDataProvider" finished-at="2018-03-06T11:53:00Z">
          <params>
            <param index="0">
              <value>
                <![CDATA[2]]>
              </value>
            </param>
            <param index="1">
              <value>
                <![CDATA[3]]>
              </value>
            </param>
            <param index="2">
              <value>
                <![CDATA[4]]>
              </value>
            </param>
          </params>
          <exception class="java.lang.AssertionError">
            <message>
              <![CDATA[expected [4] but found [5]]]>
            </message>
            <full-stacktrace>
              <![CDATA[java.lang.AssertionError: expected [4] but found [5]
	at org.testng.Assert.fail(Assert.java:93)
	at org.testng.Assert.failNotEquals(Assert.java:512)
	at org.testng.Assert.assertEqualsImpl(Assert.java:134)
	at org.testng.Assert.assertEquals(Assert.java:115)
	at org.testng.Assert.assertEquals(Assert.java:388)
	at org.testng.Assert.assertEquals(Assert.java:398)
	at com.xpand.java.CalcTest.CanAddNumbersFromGivenData(CalcTest.java:40)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:661)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1193)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
	at org.testng.TestRunner.privateRun(TestRunner.java:744)
	at org.testng.TestRunner.run(TestRunner.java:602)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
	at org.testng.SuiteRunner.run(SuiteRunner.java:289)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
	at org.testng.TestNG.runSuites(TestNG.java:1144)
	at org.testng.TestNG.run(TestNG.java:1115)
	at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:283)
	at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
	at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:120)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:373)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:334)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:119)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:407)
]]>
            </full-stacktrace>
          </exception> <!-- java.lang.AssertionError -->
          <reporter-output>
          </reporter-output>
          <attributes>
            <attribute name="test">
              <![CDATA[]]>
            </attribute> <!-- test -->
            <attribute name="requirement">
              <![CDATA[CALC-1235]]>
            </attribute> <!-- requirement -->
            <attribute name="labels">
              <![CDATA[core]]>
            </attribute> <!-- labels -->
          </attributes>
        </test-method> <!-- CanAddNumbersFromGivenData -->
        <test-method status="PASS" signature="CanAddNumbersFromGivenData(int, int, int)[pri:0, instance:com.xpand.java.CalcTest@36d4b5c]" name="CanAddNumbersFromGivenData" duration-ms="0" started-at="2018-03-06T11:53:00Z" data-provider="ValidDataProvider" finished-at="2018-03-06T11:53:00Z">
          <params>
            <param index="0">
              <value>
                <![CDATA[-1]]>
              </value>
            </param>
            <param index="1">
              <value>
                <![CDATA[1]]>
              </value>
            </param>
            <param index="2">
              <value>
                <![CDATA[0]]>
              </value>
            </param>
          </params>
          <reporter-output>
          </reporter-output>
          <attributes>
            <attribute name="test">
              <![CDATA[]]>
            </attribute> <!-- test -->
            <attribute name="requirement">
              <![CDATA[CALC-1235]]>
            </attribute> <!-- requirement -->
            <attribute name="labels">
              <![CDATA[core]]>
            </attribute> <!-- labels -->
          </attributes>
        </test-method> <!-- CanAddNumbersFromGivenData -->
        <test-method status="FAIL" signature="CanDoStuff()[pri:0, instance:com.xpand.java.CalcTest@36d4b5c]" name="CanDoStuff" duration-ms="0" started-at="2018-03-06T11:53:00Z" finished-at="2018-03-06T11:53:00Z">
          <exception class="java.lang.AssertionError">
            <message>
              <![CDATA[null]]>
            </message>
            <full-stacktrace>
              <![CDATA[java.lang.AssertionError: null
	at org.testng.Assert.fail(Assert.java:93)
	at org.testng.Assert.assertNotEquals(Assert.java:897)
	at org.testng.Assert.assertNotEquals(Assert.java:902)
	at com.xpand.java.CalcTest.CanDoStuff(CalcTest.java:86)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:661)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1193)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
	at org.testng.TestRunner.privateRun(TestRunner.java:744)
	at org.testng.TestRunner.run(TestRunner.java:602)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
	at org.testng.SuiteRunner.run(SuiteRunner.java:289)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
	at org.testng.TestNG.runSuites(TestNG.java:1144)
	at org.testng.TestNG.run(TestNG.java:1115)
	at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:283)
	at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
	at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:120)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:373)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:334)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:119)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:407)
]]>
            </full-stacktrace>
          </exception> <!-- java.lang.AssertionError -->
          <reporter-output>
          </reporter-output>
        </test-method> <!-- CanDoStuff -->
        <test-method status="PASS" signature="CanDivide()[pri:0, instance:com.xpand.java.CalcTest@36d4b5c]" name="CanDivide" duration-ms="0" started-at="2018-03-06T11:53:00Z" finished-at="2018-03-06T11:53:00Z">
          <reporter-output>
          </reporter-output>
          <attributes>
            <attribute name="test">
              <![CDATA[]]>
            </attribute> <!-- test -->
            <attribute name="requirement">
              <![CDATA[CALC-1235]]>
            </attribute> <!-- requirement -->
            <attribute name="labels">
              <![CDATA[core]]>
            </attribute> <!-- labels -->
          </attributes>
        </test-method> <!-- CanDivide -->
        <test-method status="PASS" signature="CanMultiplyX()[pri:0, instance:com.xpand.java.CalcTest@36d4b5c]" name="CanMultiplyX" duration-ms="0" started-at="2018-03-06T11:53:00Z" finished-at="2018-03-06T11:53:00Z">
          <reporter-output>
          </reporter-output>
          <attributes>
            <attribute name="test">
              <![CDATA[]]>
            </attribute> <!-- test -->
            <attribute name="requirement">
              <![CDATA[CALC-1235]]>
            </attribute> <!-- requirement -->
            <attribute name="labels">
              <![CDATA[core]]>
            </attribute> <!-- labels -->
          </attributes>
        </test-method> <!-- CanMultiplyX -->
        <test-method status="PASS" signature="CanSubtract()[pri:0, instance:com.xpand.java.CalcTest@36d4b5c]" name="CanSubtract" duration-ms="0" started-at="2018-03-06T11:53:00Z" finished-at="2018-03-06T11:53:00Z">
          <reporter-output>
          </reporter-output>
          <attributes>
            <attribute name="test">
              <![CDATA[]]>
            </attribute> <!-- test -->
            <attribute name="requirement">
              <![CDATA[CALC-1235]]>
            </attribute> <!-- requirement -->
            <attribute name="labels">
              <![CDATA[core]]>
            </attribute> <!-- labels -->
          </attributes>
        </test-method> <!-- CanSubtract -->
        <test-method status="PASS" signature="tearDown()[pri:0, instance:com.xpand.java.CalcTest@36d4b5c]" name="tearDown" is-config="true" duration-ms="0" started-at="2018-03-06T11:53:00Z" finished-at="2018-03-06T11:53:00Z">
          <reporter-output>
          </reporter-output>
        </test-method> <!-- tearDown -->
      </class> <!-- com.xpand.java.CalcTest -->
    </test> <!-- calculator -->
  </suite> <!-- TestAll -->
</testng-results> 
Code Block
titleTest Exec Info JSON
{
	"fields": {
		"project": {
			"id": "10402"
		},
		"summary": "Test Execution for TestNG 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/testng/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"
  }
}

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.

NUnit XML results

After executing NUnit tests, you must import the outputted XML execution results to Jira using the following endpoint:

,
  "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.

NUnit XML results

After executing NUnit tests, you must import the outputted XML execution results to Jira using the following endpoint:


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

Import the execution results created with the NUnit XML output formatter. For more information please check the documentation about NUnit 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
titleNUnit Report XML
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<test-run id="0" testcasecount="14" total="14" passed="13" failed="1" inconclusive="0" skipped="0" asserts="14" result="Failed" portable-engine-version="3.3.0.0"
Expand
titlePOST /rest/raven/1.0/import/execution/nunit

multipart/form-data:

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

Example

Panel
borderColor#ccc
borderStylesolid

Import the execution results created with the NUnit XML output formatter. For more information please check the documentation about NUnit 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).

Code Block
titleNUnit Report XML
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<test-run id="0" testcasecount="14" total="14" passed="13" failed="1" inconclusive="0" skipped="0" asserts="14" result="Failed" portable-engine-version="3.3.0.0" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.140400">
<test-suite type="Assembly" id="1021" name="x, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" fullname="x, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" runstate="Runnable" testcasecount="14" result="Failed" site="Child" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.110549" total="14" passed="13" failed="1" inconclusive="0" skipped="0" asserts="14">
  <settings>
    <setting name="WorkDirectory" value="C:\Users\Sergio\x" />
  </settings>
  <failure>
    <message><![CDATA[One or more child tests had errors]]></message>
  </failure>
  <test-suite type="TestFixture" id="1000" name="TestClass" fullname="TestClass" classname="TestClass" runstate="Runnable" testcasecount="2" result="Failed" site="Child" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.084668" total="2" passed="1" failed="1" inconclusive="0" skipped="0" asserts="2">
    <failure>
      <message><![CDATA[One or more child tests had errors]]></message>
    </failure>
    <test-suite type="ParameterizedMethod" id="1003" name="SubtractTest" fullname="TestClass.SubtractTest" classname="TestClass" runstate="Runnable" testcasecount="2" result="Failed" site="Child" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.080887" total="2" passed="1" failed="1" inconclusive="0" skipped="0" asserts="2">
        <properties>
            <property name="Requirement" value="DEV-771" />
          </properties><failure>
        <message><![CDATA[One or more child tests had errors]]></message>
      </failure>
      <test-case id="1001" name="SubtractTest(1)" fullname="TestClass.SubtractTest(1)" methodname="SubtractTest" classname="TestClass" runstate="Runnable" seed="1166833138" result="Failed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.043525140400">
<test-suite assertstype="1Assembly">
 id="1021" name="x, Version=1.0.0.0,     <failure>
          <message><![CDATA[  Expected: 10
But was:  1
]]></message>
          <stack-trace><![CDATA[at TestClass.SubtractTest(Int32 x) in Culture=neutral, PublicKeyToken=null" fullname="x, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" runstate="Runnable" testcasecount="14" result="Failed" site="Child" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.110549" total="14" passed="13" failed="1" inconclusive="0" skipped="0" asserts="14">
  <settings>
    <setting name="WorkDirectory" value="C:\Users\Sergio\x\TestClass.cs:line 13
]]></stack-trace>" />
  </settings>
  <failure>
    <message><![CDATA[One or </failure>
more child tests had errors]]></message>
  </test-case>
    failure>
  <test-casesuite idtype="1002TestFixture" nameid="SubtractTest(10)1000" fullnamename="TestClass.SubtractTest(10)" methodnamefullname="SubtractTestTestClass" classname="TestClass" runstate="Runnable" seedtestcasecount="10031468072" result="Failed" site="Child" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="12.0000980.084668" total="2" assertspassed="1" />failed="1" inconclusive="0" skipped="0" asserts="2">
    </test-suite>
<failure>
      <message><![CDATA[One or more child tests had errors]]></message>
    </test-suite>failure>
    <test-suite type="TestSuiteParameterizedMethod" id="10221003" name="xSubtractTest" fullname="xTestClass.SubtractTest" classname="TestClass" runstate="Runnable" testcasecount="122" result="Failed" site="PassedChild" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.015218080887" total="122" passed="121" failed="01" inconclusive="0" skipped="0" asserts="122">
    <test-suite type="TestFixture"    <properties>
            <property name="Requirement" value="DEV-771" />
          </properties><failure>
        <message><![CDATA[One or more child tests had errors]]></message>
      </failure>
      <test-case id="10041001" name="CalculatorTestsSubtractTest(1)" fullname="x.CalculatorTestsTestClass.SubtractTest(1)" methodname="SubtractTest" classname="x.CalculatorTestsTestClass" runstate="Runnable" testcasecountseed="121166833138" result="PassedFailed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.014979" total="12" passed="12" failed="0" inconclusive="0" skipped="0" 043525" asserts="121">
      <test-suite type="ParameterizedMethod" id="1008" name="CanAddNumbers" fullname="x.CalculatorTests.CanAddNumbers" classname="x.CalculatorTests" runstate="Runnable" testcasecount="3" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.004228" total="3" passed="3" failed="0" inconclusive="0" skipped="0" asserts="3">  <failure>
          <message><![CDATA[  Expected: 10
But was:  1
]]></message>
          <properties>
     <stack-trace><![CDATA[at TestClass.SubtractTest(Int32 x) in C:\Users\Sergio\x\TestClass.cs:line 13
]]></stack-trace>
       <property name="Requirement" value="DEV-771" /> </failure>
          </properties>test-case>
        <test-case id="10051002" name="CanAddNumbers(1,1,2SubtractTest(10)" fullname="xTestClass.CalculatorTests.CanAddNumbers(1,1,2SubtractTest(10)" methodname="CanAddNumbersSubtractTest" classname="x.CalculatorTestsTestClass" runstate="Runnable" seed="18463895841003146807" result="PassedFailed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="012.001194000098" asserts="1" />
    </test-suite>
  </test-suite>
  <test-casesuite idtype="1006TestSuite" nameid="CanAddNumbers(-1,-1,-2)1022" fullnamename="x.CalculatorTests.CanAddNumbers(-1,-1,-2)" methodnamefullname="CanAddNumbers" classname="x.CalculatorTests" runstate="Runnable" seedtestcasecount="111378098912" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000067015218" assertstotal="112" />
    passed="12" failed="0" inconclusive="0" skipped="0" asserts="12">
    <test-casesuite type="TestFixture" id="10071004" name="CanAddNumbers(100,5,105)CalculatorTests" fullname="x.CalculatorTests.CanAddNumbers(100,5,105)" methodname="CanAddNumbers" classname="x.CalculatorTests" runstate="Runnable" seedtestcasecount="158533296612" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000103014979" assertstotal="112" />
      </test-suite>passed="12" failed="0" inconclusive="0" skipped="0" asserts="12">
      <test-suite type="ParameterizedMethod" id="10201008" name="CanDivideCanAddNumbers" fullname="x.CalculatorTests.CanDivideCanAddNumbers" classname="x.CalculatorTests" runstate="Runnable" testcasecount="3" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.004041004228" total="3" passed="3" failed="0" inconclusive="0" skipped="0" asserts="3">
          <properties>
            <property name="Requirement" value="DEV-771" />
          </properties>
        <test-case id="10171005" name="CanDivideCanAddNumbers(1,1,12)" fullname="x.CalculatorTests.CanDivideCanAddNumbers(1,1,12)" methodname="CanDivideCanAddNumbers" classname="x.CalculatorTests" runstate="Runnable" seed="12855012521846389584" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000354001194" asserts="1" />
        <test-case id="10181006" name="CanDivideCanAddNumbers(-1,-1,1-2)" fullname="x.CalculatorTests.CanDivideCanAddNumbers(-1,-1,1-2)" methodname="CanDivideCanAddNumbers" classname="x.CalculatorTests" runstate="Runnable" seed="14364367191113780989" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000073000067" asserts="1" />
        <test-case id="10191007" name="CanDivideCanAddNumbers(100,5,20105)" fullname="x.CalculatorTests.CanDivideCanAddNumbers(100,5,20105)" methodname="CanDivideCanAddNumbers" classname="x.CalculatorTests" runstate="Runnable" seed="2133108881585332966" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000060000103" asserts="1" />
      </test-suite>
      <test-suite type="ParameterizedMethod" id="10161020" name="CanMultiplyCanDivide" fullname="x.CalculatorTests.CanMultiplyCanDivide" classname="x.CalculatorTests" runstate="Runnable" testcasecount="3" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.002759004041" total="3" passed="3" failed="0" inconclusive="0" skipped="0" asserts="3">
          <test-case id="1013" name="CanMultiply(1,1,1)" fullname="x.CalculatorTests.CanMultiply<properties>
            <property name="Requirement" value="DEV-771" />
          </properties>
        <test-case id="1017" name="CanDivide(1,1,1)" fullname="x.CalculatorTests.CanDivide(1,1,1)" methodname="CanMultiplyCanDivide" classname="x.CalculatorTests" runstate="Runnable" seed="11927351271285501252" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000331000354" asserts="1">
                  <properties>
            <property name="label" value="multiplication" />
          </properties>
          </test-case>
        <test-case id="10141018" name="CanMultiplyCanDivide(-1,-1,1)" fullname="x.CalculatorTests.CanMultiplyCanDivide(-1,-1,1)" methodname="CanMultiplyCanDivide" classname="x.CalculatorTests" runstate="Runnable" seed="399880641436436719" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000059000073" asserts="1">
                  <properties>
            <property name="label" value="multiplication" />
          </properties>
          </test-case>
        <test-case id="10151019" name="CanMultiplyCanDivide(100,5,50020)" fullname="x.CalculatorTests.CanMultiplyCanDivide(100,5,50020)" methodname="CanMultiplyAgainCanDivide" classname="x.CalculatorTests" runstate="Runnable" seed="1462346243213310888" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000052000060" asserts="1" />
      </test-suite>
      <test-suite type="ParameterizedMethod"     <properties>
            <property name="requirement" value="DEV-34" />
          </properties>
          </test-case>
      </test-suite>
      <test-suite type="ParameterizedMethod" id="1012" name="CanSubtract" id="1016" name="CanMultiply" fullname="x.CalculatorTests.CanSubtractCanMultiply" classname="x.CalculatorTests" runstate="Runnable" testcasecount="3" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.002827002759" total="3" passed="3" failed="0" inconclusive="0" skipped="0" asserts="3">
          <properties>
            <property name="requirement" value="DEV-328" />
          </properties>
        <test-case id="10091013" name="CanSubtractCanMultiply(1,1,01)" fullname="x.CalculatorTests.CanSubtractCanMultiply(1,1,01)" methodname="CanSubtractCanMultiply" classname="x.CalculatorTests" runstate="Runnable" seed="10193577341192735127" result="FailedPassed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000303000331" asserts="1">
             <failure>
     <properties>
            <property  <message><![CDATA[Error subtracting]]></message>name="label" value="multiplication" />
          </failure>properties>
          </test-case>
        <test-case id="10101014" name="CanSubtractCanMultiply(-1,-1,01)" fullname="x.CalculatorTests.CanSubtractCanMultiply(-1,-1,01)" methodname="CanSubtractCanMultiply" classname="x.CalculatorTests" runstate="Runnable" seed="132202261539988064" result="FailedPassed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000056000059" asserts="1" >
              <failure>
    <properties>
    <message><![CDATA[Error subtracting]]></message>
      </failure>
 <property name="label" value="multiplication" />
          </properties>
          </test-case>
        <test-case id="10111015" name="CanSubtractCanMultiply(100,5,95500)" fullname="x.CalculatorTests.CanSubtractCanMultiply(100,5,95500)" methodname="CanSubtractCanMultiplyAgain" classname="x.CalculatorTests" runstate="Runnable" seed="44935531462346243" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000053000052" asserts="1">
                  <properties>
            <property name="requirement" value="DEV-34" />
          </test-suite>properties>
          </test-suite>case>
      </test-suite>
</test-suite>
</test-run>
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/nunit?projectKey=XTP

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@report.xml" http://yourserver/rest/raven/1.0/import/execution/nunit?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/nunit?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/nunit?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.

NUnit XML results Multipart

Xray provides another endpoint if you want to create new Test Executions and have control over newly-created Test Execution fields. It allows you to send one XML file (the NUnit report) and a JSON similar to the one Jira uses to create new issues. For more information about that second format, check the Jira documentation here.

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

Import the execution results created with the NUnit XML output formatter. For more information please check the documentation about NUnit 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
titleNUnit Report XML
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<test-run id="0" testcasecount="14" total="14" passed="13" failed="1" inconclusive="0" skipped="0" asserts="14" result="Failed" portable-engine-version="3.3.0.0"      <test-suite type="ParameterizedMethod" id="1012" name="CanSubtract" fullname="x.CalculatorTests.CanSubtract" classname="x.CalculatorTests" runstate="Runnable" testcasecount="3" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.002827" total="3" passed="3" failed="0" inconclusive="0" skipped="0" asserts="3">
          <properties>
            <property name="requirement" value="DEV-328" />
          </properties>
        <test-case id="1009" name="CanSubtract(1,1,0)" fullname="x.CalculatorTests.CanSubtract(1,1,0)" methodname="CanSubtract" classname="x.CalculatorTests" runstate="Runnable" seed="1019357734" result="Failed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.140400">
<test-suite type="Assembly" id="1021000303" asserts="1">
          <failure>
            <message><![CDATA[Error subtracting]]></message>
          </failure>
      </test-case>
        <test-case id="1010" name="x, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullCanSubtract(-1,-1,0)" fullname="x, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.CalculatorTests.CanSubtract(-1,-1,0)" methodname="CanSubtract" classname="x.CalculatorTests" runstate="Runnable" testcasecountseed="141322022615" result="Failed" site="Child" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.110549000056" totalasserts="14" passed="13" failed="1" inconclusive="0" skipped="0" asserts="14">
  <settings>
     <setting name="WorkDirectory" value="C:\Users\Sergio\x" />
  </settings>
  <failure>
        <message><![CDATA[One or more child tests had errors]]></message>
Error subtracting]]></message>
      </failure>
      </failure>
test-case>
        <test-suitecase typeid="TestFixture1011" idname="1000CanSubtract(100,5,95)" namefullname="TestClassx.CalculatorTests.CanSubtract(100,5,95)" fullnamemethodname="TestClassCanSubtract" classname="TestClassx.CalculatorTests" runstate="Runnable" testcasecountseed="24493553" result="FailedPassed" site="Child" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.084668000053" total="2" passedasserts="1" failed="1" inconclusive="0" skipped="0" asserts="2"/>
    <failure>
  </test-suite>
    </test-suite>
  </test-suite>
</test-suite>
</test-run>


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/nunit?projectKey=XTP

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@report.xml" http://yourserver/rest/raven/1.0/import/execution/nunit?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/nunit?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/nunit?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.

NUnit XML results Multipart

Xray provides another endpoint if you want to create new Test Executions and have control over newly-created Test Execution and Test fields. It allows you to send one XML file (the NUnit report) and two JSON files similar to the one Jira uses to create new issues. For more information about that second format, check the Jira documentation here.

As of the creation of Test issues, some field values in the JSON file for Test Issue creation will follow some rules:

  • Issue Type: Overridden by the Test issue type;
  • Summary: Overridden by the internally generated summary;
  • Parent: This field is ignored;
  • Generic Test Definition: Not allowed to provide a value for this field.


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

Import the execution results created with the NUnit XML output formatter. For more information please check the documentation about NUnit 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
titleNUnit Report XML
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<test-run id="0" testcasecount="14" total="14" passed="13" failed="1" inconclusive="0" skipped="0" asserts="14" result="Failed" portable-engine-version="3.3.0.0" <message><![CDATA[One or more child tests had errors]]></message>
    </failure>
    <test-suite type="ParameterizedMethod" id="1003" name="SubtractTest" fullname="TestClass.SubtractTest" classname="TestClass" runstate="Runnable" testcasecount="2" result="Failed" site="Child" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.080887" total="2" passed="1" failed="1" inconclusive="0" skipped="0" asserts="2">
        <properties>
            <property name="Requirement" value="DEV-771" />
          </properties><failure>
        <message><![CDATA[One or more child tests had errors]]></message>
      </failure>
      <test-case id="1001" name="SubtractTest(1)" fullname="TestClass.SubtractTest(1)" methodname="SubtractTest" classname="TestClass" runstate="Runnable" seed="1166833138" result="Failed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.043525" asserts="1">
        <failure>
          <message><![CDATA[  Expected: 10
But was:  1
]]></message>
          <stack-trace><![CDATA[at TestClass.SubtractTest(Int32 x) in C:\Users\Sergio\x\TestClass.cs:line 13
]]></stack-trace>
        </failure>
      </test-case>
      <test-case id="1002" name="SubtractTest(10)" fullname="TestClass.SubtractTest(10)" methodname="SubtractTest" classname="TestClass" runstate="Runnable" seed="1003146807" result="Failed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="120.000098" asserts="1" />
    </test-suite>
  </test-suite>
  140400">
<test-suite type="TestSuiteAssembly" id="10221021" name="x, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" fullname="x, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" runstate="Runnable" testcasecount="1214" result="Failed" site="PassedChild" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.015218110549" total="1214" passed="1213" failed="01" inconclusive="0" skipped="0" asserts="14">
  <settings>
    <setting name="12">
  "WorkDirectory" value="C:\Users\Sergio\x" />
  </settings>
  <failure>
    <message><![CDATA[One or more child tests had errors]]></message>
  </failure>
  <test-suite type="TestFixture" id="10041000" name="CalculatorTestsTestClass" fullname="x.CalculatorTestsTestClass" classname="x.CalculatorTestsTestClass" runstate="Runnable" testcasecount="122" result="Passed"Failed" site="Child" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.014979084668" total="122" passed="121" failed="01" inconclusive="0" skipped="0" asserts="12">
      2">
    <failure>
      <message><![CDATA[One or more child tests had errors]]></message>
    </failure>
    <test-suite type="ParameterizedMethod" id="10081003" name="CanAddNumbersSubtractTest" fullname="xTestClass.CalculatorTests.CanAddNumbersSubtractTest" classname="x.CalculatorTestsTestClass" runstate="Runnable" testcasecount="32" result="PassedFailed" site="Child" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.004228080887" total="32" passed="31" failed="01" inconclusive="0" skipped="0" asserts="32">
          <properties>
            <property name="Requirement" value="DEV-771" />
          </properties>/properties><failure>
        <message><![CDATA[One or more child tests had errors]]></message>
      </failure>
      <test-case id="10051001" name="CanAddNumbersSubtractTest(1,1,2)" fullname="xTestClass.CalculatorTests.CanAddNumbersSubtractTest(1,1,2)" methodname="CanAddNumbersSubtractTest" classname="x.CalculatorTestsTestClass" runstate="Runnable" seed="18463895841166833138" result="PassedFailed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.001194043525" asserts="1" />
        <test-case id="1006" name="CanAddNumbers(-1,-1,-2)" fullname="x.CalculatorTests.CanAddNumbers(-1,-1,-2)" methodname="CanAddNumbers" classname="x.CalculatorTests" runstate="Runnable" seed="1113780989" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000067" asserts="1" />
  <failure>
          <message><![CDATA[  Expected: 10
But was:  1
]]></message>
          <stack-trace><![CDATA[at TestClass.SubtractTest(Int32 x) in C:\Users\Sergio\x\TestClass.cs:line 13
]]></stack-trace>
        </failure>
      </test-case>
      <test-case id="10071002" name="CanAddNumbers(100,5,105SubtractTest(10)" fullname="xTestClass.CalculatorTests.CanAddNumbers(100,5,105SubtractTest(10)" methodname="CanAddNumbersSubtractTest" classname="x.CalculatorTestsTestClass" runstate="Runnable" seed="15853329661003146807" result="PassedFailed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="012.000103000098" asserts="1" />
    </test-suite>
  </test-suite>
      <test-suite type="ParameterizedMethodTestSuite" id="10201022" name="CanDividex" fullname="x.CalculatorTests.CanDivide" classname="x.CalculatorTests" runstate="Runnable" testcasecount="312" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.004041015218" total="312" passed="312" failed="0" inconclusive="0" skipped="0" asserts="312">
          <properties>
            <property name="Requirement" value="DEV-771" />
          </properties>
        <test-case<test-suite type="TestFixture" id="10171004" name="CanDivide(1,1,1)CalculatorTests" fullname="x.CalculatorTests.CanDivide(1,1,1)" methodname="CanDivide" classname="x.CalculatorTests" runstate="Runnable" seedtestcasecount="128550125212" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000354014979" total="12" passed="12" failed="0" inconclusive="0" skipped="0" asserts="112" />
        <test-casesuite type="ParameterizedMethod" id="10181008" name="CanDivide(-1,-1,1)CanAddNumbers" fullname="x.CalculatorTests.CanDivide(-1,-1,1)CanAddNumbers" methodname="CanDivide" classname="x.CalculatorTests" runstate="Runnable" seedtestcasecount="14364367193" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000073004228" assertstotal="13" />
        <test-case idpassed="10193" namefailed="CanDivide(100,5,20)0" fullnameinconclusive="x.CalculatorTests.CanDivide(100,5,20)0" methodnameskipped="CanDivide0" classnameasserts="x.CalculatorTests" runstate="Runnable" seed="213310888" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000060" asserts="13">
          <properties>
            <property name="Requirement" value="DEV-771" />
          </test-suite>properties>
        <test-suite type="ParameterizedMethod"case id="10161005" name="CanMultiplyCanAddNumbers(1,1,2)" fullname="x.CalculatorTests.CanMultiplyCanAddNumbers(1,1,2)" methodname="CanAddNumbers" classname="x.CalculatorTests" runstate="Runnable" testcasecountseed="31846389584" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.002759001194" totalasserts="3" passed="3" failed="0" inconclusive="0" skipped="0" asserts="3"1" />
        <test-case id="10131006" name="CanMultiplyCanAddNumbers(-1,-1,1-2)" fullname="x.CalculatorTests.CanMultiplyCanAddNumbers(-1,-1,1-2)" methodname="CanMultiplyCanAddNumbers" classname="x.CalculatorTests" runstate="Runnable" seed="11927351271113780989" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000331000067" asserts="1">
                  <properties>
            <property name="label" value="multiplication" />
          </properties>
          </test-case>
        <test-case id="10141007" name="CanMultiplyCanAddNumbers(-1100,-15,1105)" fullname="x.CalculatorTests.CanMultiplyCanAddNumbers(-1100,-15,1105)" methodname="CanMultiplyCanAddNumbers" classname="x.CalculatorTests" runstate="Runnable" seed="399880641585332966" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000059000103" asserts="1" />
                  <properties></test-suite>
            <property name="label" value="multiplication" />
          </properties>
          </test-case>
        <test-case id="1015<test-suite type="ParameterizedMethod" id="1020" name="CanMultiply(100,5,500)CanDivide" fullname="x.CalculatorTests.CanMultiply(100,5,500)CanDivide" methodname="CanMultiplyAgain" classname="x.CalculatorTests" runstate="Runnable" seedtestcasecount="14623462433" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000052004041" assertstotal="13">
 passed="3" failed="0" inconclusive="0"     skipped="0" asserts="3">
          <properties>
            <property name="requirementRequirement" value="DEV-34771" />
          </properties>
          </test-case>
      </test-suite>
      <test-suite type="ParameterizedMethod"<test-case id="10121017" name="CanSubtractCanDivide(1,1,1)" fullname="x.CalculatorTests.CanSubtractCanDivide(1,1,1)" methodname="CanDivide" classname="x.CalculatorTests" runstate="Runnable" testcasecountseed="31285501252" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.002827000354" totalasserts="3" passed="3" failed="0" inconclusive="0" skipped="0" asserts="3"1" />
        <test-case  <properties>
            <property name="requirement" value="DEV-328" />
          </properties>
        <test-case id="1009" name="CanSubtract(1,1,0id="1018" name="CanDivide(-1,-1,1)" fullname="x.CalculatorTests.CanSubtractCanDivide(-1,-1,01)" methodname="CanSubtractCanDivide" classname="x.CalculatorTests" runstate="Runnable" seed="10193577341436436719" result="FailedPassed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000303000073" asserts="1">
          <failure>
            <message><![CDATA[Error subtracting]]></message>
          </failure>/>
      </test-case>
        <test-case id="10101019" name="CanSubtractCanDivide(-1100,-15,020)" fullname="x.CalculatorTests.CanSubtractCanDivide(-1100,-15,020)" methodname="CanSubtractCanDivide" classname="x.CalculatorTests" runstate="Runnable" seed="1322022615213310888" result="FailedPassed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000056000060" asserts="1" >
              <failure>
        <message><![CDATA[Error subtracting]]></message>
      </failure>/>
      </test-case>suite>
        <test-casesuite type="ParameterizedMethod" id="10111016" name="CanSubtract(100,5,95)CanMultiply" fullname="x.CalculatorTests.CanSubtract(100,5,95)" methodname="CanSubtractCanMultiply" classname="x.CalculatorTests" runstate="Runnable" seedtestcasecount="44935533" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000053002759" assertstotal="13" />
      </test-suite>
passed="3" failed="0" inconclusive="0" skipped="0" asserts="3">
      </test-suite>
  </test-suite>
</test-suite>
</test-run>
Code Block
titleInfo JSON
{
	"fields": {
		"project": {
			"id": "10402"
		},
		"summary": "Test Execution for nunit Execution",
		"issuetype": {
			"id": "10007"
		},
		"components" : [
			{
			"name":"Interface"
			},
			{
			"name":"Core"
			}
		]
	}
}
Tip
titleExample Request

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

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.

Robot Framework XML results

After executing Robot Framework tests, you must import the output XML execution results to Jira using the following endpoint:

<test-case id="1013" name="CanMultiply(1,1,1)" fullname="x.CalculatorTests.CanMultiply(1,1,1)" methodname="CanMultiply" classname="x.CalculatorTests" runstate="Runnable" seed="1192735127" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000331" asserts="1">
                  <properties>
            <property name="label" value="multiplication" />
          </properties>
          </test-case>
        <test-case id="1014" name="CanMultiply(-1,-1,1)" fullname="x.CalculatorTests.CanMultiply(-1,-1,1)" methodname="CanMultiply" classname="x.CalculatorTests" runstate="Runnable" seed="39988064" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000059" asserts="1">
                  <properties>
            <property name="label" value="multiplication" />
          </properties>
          </test-case>
        <test-case id="1015" name="CanMultiply(100,5,500)" fullname="x.CalculatorTests.CanMultiply(100,5,500)" methodname="CanMultiplyAgain" classname="x.CalculatorTests" runstate="Runnable" seed="1462346243" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000052" asserts="1">
                  <properties>
            <property name="requirement" value="DEV-34" />
          </properties>
          </test-case>
      </test-suite>
      <test-suite type="ParameterizedMethod" id="1012" name="CanSubtract" fullname="x.CalculatorTests.CanSubtract" classname="x.CalculatorTests" runstate="Runnable" testcasecount="3" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.002827" total="3" passed="3" failed="0" inconclusive="0" skipped="0" asserts="3">
          <properties>
            <property name="requirement" value="DEV-328" />
          </properties>
        <test-case id="1009" name="CanSubtract(1,1,0)" fullname="x.CalculatorTests.CanSubtract(1,1,0)" methodname="CanSubtract" classname="x.CalculatorTests" runstate="Runnable" seed="1019357734" result="Failed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000303" asserts="1">
          <failure>
            <message><![CDATA[Error subtracting]]></message>
          </failure>
      </test-case>
        <test-case id="1010" name="CanSubtract(-1,-1,0)" fullname="x.CalculatorTests.CanSubtract(-1,-1,0)" methodname="CanSubtract" classname="x.CalculatorTests" runstate="Runnable" seed="1322022615" result="Failed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000056" asserts="1" >
              <failure>
        <message><![CDATA[Error subtracting]]></message>
      </failure>
      </test-case>
        <test-case id="1011" name="CanSubtract(100,5,95)" fullname="x.CalculatorTests.CanSubtract(100,5,95)" methodname="CanSubtract" classname="x.CalculatorTests" runstate="Runnable" seed="4493553" result="Passed" start-time="2016-12-26 14:36:03Z" end-time="2016-12-26 14:36:03Z" duration="0.000053" asserts="1" />
      </test-suite>
    </test-suite>
  </test-suite>
</test-suite>
</test-run>
Code Block
titleTest Exec Info JSON
{
	"fields": {
		"project": {
			"id": "10402"
		},
		"summary": "Test Execution for nunit 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/nunit/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.

Robot Framework XML results

After executing Robot Framework tests, you must import the output XML execution results to Jira using the following endpoint:


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

Import the execution results from Robot Framework XML output format.

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
titleRobot Report XML
<?xml version="1.0" encoding="UTF-8"?>
<robot generated="20170220 14:18:54.562" generator="Robot 3.0.2 (Python 2.7.13 on win32)">
  <suite source="C:\Users\lmfv\Documents\Saco de Features\xray-1238\robot-example\robotframework-webdemo\login_tests" id="s1" name="Login Tests">
    <suite source="C:\Users\lmfv\Documents\Saco de Features\xray-1238\robot-example\robotframework-webdemo\login_tests\gherkin_login.robot" id="s1-s1" name="Gherkin Login">
      <test id="s1-s1-t1" name="Gherkin Valid Login">
        <kw name="Given browser is opened to login page">
          <kw name="Login Page Should Be Open" library="resource">
            <kw name="Title Should Be" library="Selenium2Library">
              <doc>Verifies that current page title equals `title`.</doc>
              <arguments>
                <arg>Log in - Your Company JIRA</arg>
              </arguments>
              <msg timestamp="20170220 14:19:07.693" level="INFO">Page title is 'Log in - Your Company JIRA'.</msg>
              <status status="PASS" endtime="20170220 14:19:07.693" starttime="20170220 14:19:07.158">
              </status>
            </kw>
            <status status="PASS" endtime="20170220 14:19:07.693" starttime="20170220 14:19:07.158">
            </status>
          </kw>
          <status status="PASS" endtime="20170220 14:19:07.693" starttime="20170220 14:18:55.937">
          </status>
        </kw>
Expand
titlePOST /rest/raven/1.0/import/execution/robot

multipart/form-data:

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

Example

Panel
borderColor#ccc
borderStylesolid

Import the execution results from Robot Framework XML output format.

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).

Code Block
titleRobot Report XML
<?xml version="1.0" encoding="UTF-8"?>
<robot generated="20170220 14:18:54.562" generator="Robot 3.0.2 (Python 2.7.13 on win32)">
  <suite source="C:\Users\lmfv\Documents\Saco de Features\xray-1238\robot-example\robotframework-webdemo\login_tests" id="s1" name="Login Tests">
    <suite source="C:\Users\lmfv\Documents\Saco de Features\xray-1238\robot-example\robotframework-webdemo\login_tests\gherkin_login.robot" id="s1-s1" name="Gherkin Login">
      <test id="s1-s1-t1" name="Gherkin Valid Login">
        <kw name="Given browser is opened to login pageWhen user &quot;admin&quot; logs in with password &quot;password123&quot;">
          <kw name="Login Page Should Be OpenInput Username" library="resource">
            <arguments>
              <arg>${username}</arg>
            </arguments>
            <kw name="TitleInput Should BeText" library="Selenium2Library">
              <doc>Verifies that current page title equals `title`<doc>Types the given `text` into text field identified by `locator`.</doc>
              <arguments>
                <arg>Log in - Your Company JIRA<<arg>login-form-username</arg>
                <arg>${username}</arguments>arg>
              <msg timestamp="20170220 14:19:07.693" level="INFO">Page title is 'Log in - Your Company JIRA'.</msg> </arguments>
              <status<msg statustimestamp="PASS" endtime="20170220 14:19:07.693696" starttimelevel="20170220 14:19:07.158">
              </status>
            </kw>
INFO">Typing text 'admin' into text field 'login-form-username'</msg>
              <status status="PASS" endtime="20170220 14:19:0709.693314" starttime="20170220 14:19:07.158696">
              </status>
            </kw>
            <status status="PASS" endtime="20170220 14:19:0709.693314" starttime="20170220 14:1819:5507.937695">
            </status>
          </kw>
        <kw name="When user &quot;admin&quot; logs in with password &quot;password123&quot;">
          <kw name="Input UsernamePassword" library="resource">
            <arguments>
              <arg>${usernamepassword}</arg>
            </arguments>
            <kw name="Input Text" library="Selenium2Library">
              <doc>Types the given `text` into text field identified by `locator`.</doc>
              <arguments>
                <arg>login-form-username<password</arg>
                <arg>${usernamepassword}</arg>
              </arguments>
              <msg timestamp="20170220 14:19:0709.696316" level="INFO">Typing text 'adminpassword123' into text field 'login-form-usernamepassword'</msg>
              <status status="PASS" endtime="20170220 14:19:0910.314956" starttime="20170220 14:19:0709.696316">
              </status>
            </kw>
            <status status="PASS" endtime="20170220 14:19:0910.314956" starttime="20170220 14:19:0709.695315">
            </status>
          </kw>
          <kw name="InputSubmit PasswordCredentials" library="resource">
            <arguments>
              <arg>${password}</arg>
            </arguments>
            <kw name="InputClick TextButton" library="Selenium2Library">
              <doc>Types<doc>Clicks thea given `text` into text field button identified by `locator`.</doc>
              <arguments>
                <arg>login-form-password</arg><arguments>
                <arg>${password}<<arg>login-form-submit</arg>
              </arguments>
              <msg timestamp="20170220 14:19:0910.316958" level="INFO">Typing>Clicking textbutton 'password123' into text field 'login-form-passwordsubmit'.</msg>
              <status status="PASS" endtime="20170220 14:19:1017.956476" starttime="20170220 14:19:0910.316958">
              </status>
            </kw>
            <status status="PASS" endtime="20170220 14:19:1017.956477" starttime="20170220 14:19:0910.315957">
            </status>
          </kw>
          <status status="PASS" endtime="20170220 14:19:17.478" starttime="20170220 14:19:07.695">
          </status>
        </kw>
        <kw name="Then welcome page should be open" library="resource">
          <kw name="Location Should Be" library="Selenium2Library">
            <doc>Verifies that current URL is exactly `url`.</doc>
            <arguments>
              <arg>${WELCOME URL}</arg>
            </arguments>
            <kw name="SubmitCapture Page CredentialsScreenshot" library="resourceSelenium2Library">
              <doc>Takes a screenshot of  <kw name="Click Button" library="Selenium2Library">the current page and embeds it into the log.</doc>
              <doc>Clicks a button identified by `locator`.</doc><msg timestamp="20170220 14:19:18.702" html="yes" level="INFO">&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan="3"&gt;&lt;a href="selenium-screenshot-1.png"&gt;&lt;img src="selenium-screenshot-1.png" width="800px"&gt;&lt;/a&gt;</msg>
              <arguments>
  <status status="PASS" endtime="20170220 14:19:18.702" starttime="20170220 14:19:18.004">
              <arg>login-form-submit</arg>
  </status>
            </arguments>kw>
              <msg timestamp="20170220 14:19:1018.958705" level="INFO">Clicking button 'login-form-submit'.FAIL">Location should have been 'http://localhost:8080/secure/Dashboard.jspa' but was 'http://localhost:8080/login.jsp'</msg>
              <status status="PASSFAIL" endtime="20170220 14:19:1718.476705" starttime="20170220 14:19:1017.958483">
              </status>
            </kw>
            <status status="PASSFAIL" endtime="20170220 14:19:1718.477706" starttime="20170220 14:19:1017.957481">
            </status>
          </kw>
        <kw  <status statustype="PASSteardown" endtimename="20170220 14:19:17.478Close Browser" starttimelibrary="20170220 14:19:07.695Selenium2Library">
          </status>
<doc>Closes the       current browser.</kw>doc>
        <kw name="Then welcome page should be open" library<status status="resourcePASS">
          <kw name endtime="Location Should Be20170220 14:19:22.382" librarystarttime="Selenium2Library20170220 14:19:18.707">
          </status>
  <doc>Verifies that current URL is exactly `url`.</doc>kw>
        <tags>
    <arguments>
      <tag>WEB-1</tag>
         <arg>${WELCOME URL}</arg> <tag>WEB-3</tag>
            </arguments>tags>
        <status status="FAIL" endtime="20170220  <kw name="Capture Page Screenshot" library="Selenium2Library">
14:19:22.383" critical="yes" starttime="20170220 14:18:55.936">Location should have been 'http://localhost:8080/secure/Dashboard.jspa' but was 'http://localhost:8080/login.jsp'</status>
      </test>
      <doc>A test suite <doc>Takeswith a screenshotsingle ofGherkin thestyle currenttest.This pagetest andis embedsfunctionally itidentical intoto the log example invalid_login.robot file.</doc>
      <status        <msg timestampstatus="FAIL" endtime="20170220 14:19:1822.702397" htmlstarttime="yes" level="INFO">&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan="3"&gt;&lt;a href="selenium-screenshot-1.png"&gt;&lt;img src="selenium-screenshot-1.png" width="800px"&gt;&lt;/a&gt;</msg>20170220 14:18:54.670">
      </status>
    </suite>
          <status status="PASSFAIL" endtime="20170220 14:1922:1812.702549" starttime="20170220 14:1918:1854.004567">
              </status>
  </suite>
</robot>
Tip
titleExample Request

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

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

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

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@output.xml" http://yourserver/rest/raven/1.0/import/execution/robot?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.

Robot Framework XML results Multipart

Xray provides another endpoint if you want to create new Test Executions and have control over newly-created Test Execution and Test fields. It allows you to send one XML file (the Robot report) and a JSON similar to the one Jira uses to create new issues. For more information about that second format, check the Jira documentation here.

As of the creation of Test issues, some field values in the JSON file for Test Issue creation will follow some rules:

  • Issue Type: Overridden by the Test issue type;
  • Summary: Overridden by the internally generated summary;
  • Parent: This field is ignored;
  • Generic Test Definition: Not allowed to provide a value for this field.


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

Imports the execution results from Robot Framework XML output format. For more information please check the documentation about

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
titleRobot Report XML
<?xml version="1.0" encoding="UTF-8"?>
<robot generated          </kw>
            <msg timestamp="20170220 14:19:18.705" level="FAIL">Location should have been 'http://localhost:8080/secure/Dashboard.jspa' but was 'http://localhost:8080/login.jsp'</msg>
            <status status="FAIL" endtime="20170220 14:19:18.705" starttime="20170220 14:19:17.483">
            </status>
          </kw>
          <status status="FAIL" endtime="20170220 14:19:18.706" starttime="20170220 14:19:17.481">
          </status>
        </kw>
        <kw type="teardown" name="Close Browser" library="Selenium2Library">
          <doc>Closes the current browser.</doc>
          <status status="PASS" endtime="20170220 14:19:22.382" starttime="20170220 14:19:18.707">
          </status>
        </kw>
        <tags>
          <tag>WEB-1</tag>
          <tag>WEB-3</tag>
        </tags>
        <status status="FAIL" endtime="20170220 14:19:22.383" critical="yes" starttime="20170220 14:18:5554.936562">Location should have been 'http://localhost:8080/secure/Dashboard.jspa' but was 'http://localhost:8080/login.jsp'</status>
      </test>
      <doc>A test suite with a single Gherkin style test.This test is functionally identical to the example invalid_login.robot file.</doc>generator="Robot 3.0.2 (Python 2.7.13 on win32)">
  <suite source="C:\Users\lmfv\Documents\Saco de Features\xray-1238\robot-example\robotframework-webdemo\login_tests" id="s1" name="Login Tests">
    <suite source="C:\Users\lmfv\Documents\Saco de Features\xray-1238\robot-example\robotframework-webdemo\login_tests\gherkin_login.robot" id="s1-s1" name="Gherkin Login">
      <status<test statusid="FAILs1-s1-t1" endtimename="20170220 14:19:22.397" starttime="20170220 14:18:54.670"Gherkin Valid Login">
      </status>
  <kw  </suite>
    <status status="FAIL" endtime="20170220 14:22:12.549" starttime="20170220 14:18:54.567">
    </status>
  </suite>
</robot>
Tip
titleExample Request

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

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

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

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@output.xml" http://yourserver/rest/raven/1.0/import/execution/robot?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.

Robot Framework XML results Multipart

Xray provides another endpoint if you want to create new Test Executions and have control over newly-created Test Execution fields. It allows you to send one XML file (the Robot report) and a JSON similar to the one Jira uses to create new issues. For more information about that second format, check the Jira documentation here.

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

Imports the execution results from Robot Framework XML output format. For more information please check the documentation about

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
titleRobot Report XML
<?xml version="1.0" encoding="UTF-8"?>
<robot generated="20170220 14:18:54.562" generator="Robot 3.0.2 (Python 2.7.13 on win32)">
  <suite source="C:\Users\lmfv\Documents\Saco de Features\xray-1238\robot-example\robotframework-webdemo\login_tests" id="s1" name="Login Tests">
    <suite source="C:\Users\lmfv\Documents\Saco de Features\xray-1238\robot-example\robotframework-webdemo\login_tests\gherkin_login.robot" id="s1-s1" name="Gherkin Login">
      <test id="s1-s1-t1" name="Gherkin Valid Login">name="Given browser is opened to login page">
          <kw name="Login Page Should Be Open" library="resource">
            <kw name="Title Should Be" library="Selenium2Library">
              <doc>Verifies that current page title equals `title`.</doc>
              <arguments>
                <arg>Log in - Your Company JIRA</arg>
              </arguments>
              <msg timestamp="20170220 14:19:07.693" level="INFO">Page title is 'Log in - Your Company JIRA'.</msg>
              <status status="PASS" endtime="20170220 14:19:07.693" starttime="20170220 14:19:07.158">
              </status>
            </kw>
            <status status="PASS" endtime="20170220 14:19:07.693" starttime="20170220 14:19:07.158">
            </status>
          </kw>
          <status status="PASS" endtime="20170220 14:19:07.693" starttime="20170220 14:18:55.937">
          </status>
        </kw>
        <kw name="Given browser is opened to login pageWhen user &quot;admin&quot; logs in with password &quot;password123&quot;">
          <kw name="Login Page Should Be OpenInput Username" library="resource">
            <kw name="Title Should Be" library="Selenium2Library">
<arguments>
              <arg>${username}</arg>
      <doc>Verifies that current page title equals `title`.</doc>arguments>
            <kw  <arguments>
name="Input Text" library="Selenium2Library">
              <doc>Types the given `text` <arg>Loginto intext -field Youridentified Companyby JIRA<`locator`.</arg>doc>
              </arguments><arguments>
                <msg timestamp="20170220 14:19:07.693" level="INFO">Page title is 'Log in - Your Company JIRA'.</msg>
<arg>login-form-username</arg>
                <arg>${username}</arg>
         <status status="PASS" endtime="20170220 14:19:07.693" starttime="20170220 14:19:07.158"> </arguments>
              </status>
            </kw><msg timestamp="20170220 14:19:07.696" level="INFO">Typing text 'admin' into text field 'login-form-username'</msg>
              <status status="PASS" endtime="20170220 14:19:0709.693314" starttime="20170220 14:19:07.158696">
              </status>
            </kw>
            <status status="PASS" endtime="20170220 14:19:0709.693314" starttime="20170220 14:1819:5507.937695">
            </status>
          </kw>
        <kw name="When user &quot;admin&quot; logs in with password &quot;password123&quot;">
          <kw name="Input UsernamePassword" library="resource">
            <arguments>
              <arg>${usernamepassword}</arg>
            </arguments>
            <kw name="Input Text" library="Selenium2Library">
              <doc>Types the given `text` into text field identified by `locator`.</doc>
              <arguments>
                <arg>login-form-username<password</arg>
                <arg>${usernamepassword}</arg>
              </arguments>
              <msg timestamp="20170220 14:19:0709.696316" level="INFO">Typing text 'adminpassword123' into text field 'login-form-usernamepassword'</msg>
              <status status="PASS" endtime="20170220 14:19:0910.314956" starttime="20170220 14:19:0709.696316">
              </status>
            </kw>
            <status status="PASS" endtime="20170220 14:19:0910.314956" starttime="20170220 14:19:0709.695315">
            </status>
          </kw>
          <kw name="InputSubmit PasswordCredentials" library="resource">
            <arguments>
              <arg>${password}</arg>
            </arguments>
            <kw name="InputClick TextButton" library="Selenium2Library">
              <doc>Types<doc>Clicks thea given `text` into text field button identified by `locator`.</doc>
              <arguments>
                <arg>login-form-password<submit</arg>
                <arg>${password}</arg>arguments>
              <msg timestamp="20170220 14:19:10.958" level="INFO">Clicking button 'login-form-submit'.</arguments>msg>
               <msg timestamp<status status="PASS" endtime="20170220 14:19:17.476" starttime="20170220 14:19:0910.316" level="INFO">Typing text 'password123' into text field 'login-form-password'</msg>958">
              </status>
            </kw>
            <status status="PASS" endtime="20170220 14:19:1017.956477" starttime="20170220 14:19:0910.316957">
              </status>
            </kw>
            <status status="PASS" endtime="20170220 14:19:1017.956478" starttime="20170220 14:19:0907.315695">
            </status>
          </kw>
          <kw name="Submit CredentialsThen welcome page should be open" library="resource">
            <kw name="ClickLocation Should ButtonBe" library="Selenium2Library">
            <doc>Verifies that <doc>Clickscurrent aURL buttonis identifiedexactly by `locator``url`.</doc>
            <arguments>
    <arguments>          <arg>${WELCOME URL}</arg>
            </arguments>
            <kw name="Capture Page  <arg>login-form-submit</arg>
Screenshot" library="Selenium2Library">
              <doc>Takes a screenshot of the current page and embeds it into the log.</arguments>doc>
              <msg timestamp="20170220 14:19:10.958" level="INFO">Clicking button 'login-form-submit'.:19:18.702" html="yes" level="INFO">&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan="3"&gt;&lt;a href="selenium-screenshot-1.png"&gt;&lt;img src="selenium-screenshot-1.png" width="800px"&gt;&lt;/a&gt;</msg>
              <status status="PASS" endtime="20170220 14:19:1718.476702" starttime="20170220 14:19:1018.958004">
              </status>
            </kw>
            <msg timestamp="20170220 14:19:18.705" level="FAIL">Location should have been 'http://localhost:8080/secure/Dashboard.jspa' but was 'http://localhost:8080/login.jsp'</msg>
            <status status="PASSFAIL" endtime="20170220 14:19:1718.477705" starttime="20170220 14:19:1017.957483">
            </status>
          </kw>
          <status status="PASSFAIL" endtime="20170220 14:19:1718.478706" starttime="20170220 14:19:0717.695481">
          </status>
        </kw>
        <kw nametype="Then welcome page should be open" library="resource">
          <kw teardown" name="LocationClose Should BeBrowser" library="Selenium2Library">
          <doc>Closes  <doc>Verifies thatthe current URL is exactly `url`browser.</doc>
          <status  <arguments>
              <arg>${WELCOME URL}</arg>
            </arguments>
            <kw name="Capture Page Screenshot" library="Selenium2Librarystatus="PASS" endtime="20170220 14:19:22.382" starttime="20170220 14:19:18.707">
          </status>
    <doc>Takes a screenshot of the</kw>
 current page and embeds it into the log.</doc><tags>
          <tag>WEB-1</tag>
    <msg timestamp="20170220 14:19:18.702" html="yes" level="INFO">&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan="3"&gt;&lt;a href="selenium-screenshot-1.png"&gt;&lt;img src="selenium-screenshot-1.png" width="800px"&gt;&lt;/a&gt;</msg>
 <tag>WEB-3</tag>
        </tags>
        <status status="PASSFAIL" endtime="20170220 14:19:18.70222.383" critical="yes" starttime="20170220 14:1918:1855.004936">
>Location should have been 'http://localhost:8080/secure/Dashboard.jspa' but   was 'http://localhost:8080/login.jsp'</status>
      </status>test>
      <doc>A test suite with a single </kw>Gherkin style test.This test is functionally identical to the example invalid_login.robot file.</doc>
      <status      <msg timestampstatus="FAIL" endtime="20170220 14:19:1822.705397" levelstarttime="FAIL">Location should have been 'http://localhost:8080/secure/Dashboard.jspa' but was 'http://localhost:8080/login.jsp'</msg>20170220 14:18:54.670">
      </status>
     </suite>
       <status status="FAIL" endtime="20170220 14:1922:1812.705549" starttime="20170220 14:1918:1754.483567">
            </status>
          </kw>
          <status status="FAIL" endtime="20170220 14:19:18.706" starttime="20170220 14:19:17.481">
          </status>
        </kw></suite>
</robot>


Code Block
titleTest Exec Info JSON
{
	"fields": {
		"project": {
			"id": "10402"
		},
		"summary": "Test Execution for robot Execution",
		"issuetype": {
			"id": "10007"
		},
		"components" : [
			{
			"name":"Interface"
			},
			{
			"name":"Core"
			}
		]
	}
}
Code Block
titleTest Info JSON
{
    "fields": {
        <kw type="teardowndescription": name="CloseAutomated Browser" library="Selenium2Library">Test",
        "priority"  <doc>Closes the current browser.</doc>: {
          <status status="PASS" endtime="20170220 14:19:22.382" starttime="20170220 14:19:18.707">
	"id": "10"
        },   </status>
         </kw>"labels": [
        <tags>
    "Testing",
      <tag>WEB-1</tag>
      "Automation"
    <tag>WEB-3</tag>
    ]
    }
}


Tip
titleExample Request

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@output.xml" -F "info="@testExec.json" -F "testInfo=@test.json" http://yourserver/rest/raven/1.0/import/execution/robot/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": {</tags>
        <status status="FAIL" endtime="20170220 14:19:22.383" critical="yes" starttime="20170220 14:18:55.936">Location should have been 'http://localhost:8080/secure/Dashboard.jspa' but was 'http://localhost:8080/login.jsp'</status>
      </test>
      <doc>A test suite with a single Gherkin style test.This test is functionally identical to the example invalid_login.robot file.</doc>"success": [
            {
      <status status="FAIL" endtime="20170220 14:19:22.397" starttime="20170220 14:18:54.670">
      </status>
    </suite>"self": "http://localhost:8080/rest/api/2/issue/10201",
    <status status="FAIL" endtime="20170220 14:22:12.549" starttime="20170220 14:18:54.567">
    </status>
  </suite>
</robot>
Code Block
titleInfo JSON
{
	"fields": {
		"project": {
			       "id": "1040210201"
		},
		"summary": "Test Execution for robot Execution",
		"issuetype": {
			"id": "10007"
		},
		"components" : [
			{
			"name":"Interface"
			},
			{
			"name":"Core"
			}
		]
	}
}
Tip
titleExample Request

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

Responses

,
                "key": "XNP-25"
            },
            {
                "self": "http://localhost:8080/rest/api/2/issue/10202",
                "id": "10202",
                "key": "XNP-26"
            }
        ]
    }
}

200 OK : application/json: Successful. The 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.

...