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.

...

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.

...