Versions Compared

Key

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

...

Execution results can be imported to Jira through JSON/XML representation formats specified in Import Execution ResultsUsing Xray JSON format to import execution results

For each import file format, Xray provides a specific REST endpoint:

...

When importing execution results using Xray JSON result format in a Continuous Integration environment, you can specify which Test Execution issue to import the results on using the testExecutionKey property. Alternatively, you can create a new Test Execution for the execution results and specify the Test Execution issue fields in the info object.

...

Expand
titlePOST /api/v1/import/execution
Panel
borderColor#ccc
borderStylesolid

Import the execution results present in query variable "executionResults".

Request

Example 1: new Test Execution
Code Block
titleExample Input
{
    "info" : {
        "summary" : "Execution of automated tests for release v1.3",
		"description" : "This execution is automatically created when importing execution results from an external source",
		"version" : "v1.3",
		"user" : "admin",
		"revision" : "1.0.42134",
		"startDate" : "2014-08-30T11:47:35+01:00",
		"finishDate" : "2014-08-30T11:53:00+01:00",
		"testPlanKey" : "DEMO-100",
		"testEnvironments": ["iOS", "Android"]
    },
    "tests" : [
        {
            "testKey" : "DEMO-6",
            "start" : "2014-08-30T11:47:35+01:00",
            "finish" : "2014-08-30T11:50:56+01:00",
            "comment" : "Successful execution",
            "status" : "PASSED"
        },
        {
            "testKey" : "DEMO-7",
            "start" : "2014-08-30T11:51:00+01:00",
            "finish" : "2014-08-30T11:52:30+01:00",
            "comment" : "Execution failed. Example #5 FAIL.",
            "status" : "FAILED",
			"evidences" : [
            	{
                	"data": "iVBORw0KGgoAAAANSUhEUgAABkIAAAO9CAYAAADezXv6AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEn(...base64 file enconding)",
					"filename": "image21.jpg",
                    "contentType": "image/jpeg"
                }
			],
            "examples" : [
                "PASSED",
                "PASSED",
                "PASSED",
                "PASSED",
                "FAILED"
            ],
			"steps": [
                {
                    "status": "PASSED",
                    "comment": "Comment on Test Step Result 1",
					"actualResult:" : "Step Passed with Status Code 200",
                    "evidences" : [
                        {
                            "data": "iVBORw0KGgoAAAANSUhEUgAABkIAAAO9CAYAAADezXv6AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEn(...base64 file enconding)",
							"filename": "image22.jpg",
                            "contentType": "image/jpeg"
                        }
					]
				}
			],
		    "defects" : [
					"DEMO-10",
					"DEMO-11"
		   ]
        }
    ]
}


Example 2: update existing Test Execution
Code Block
titleExample Input
{
    "testExecutionKey": "DEMO-1206",
    "info" : {
        "summary" : "Execution of automated tests for release v1.3",
		"description" : "This execution is automatically created when importing execution results from an external source",
		"version" : "v1.3",
		"user" : "admin",
		"revision" : "1.0.42134",
		"startDate" : "2014-08-30T11:47:35+01:00",
		"finishDate" : "2014-08-30T11:53:00+01:00",
		"testPlanKey" : "DEMO-100",
		"testEnvironments": ["iOS", "Android"]
    },
    "tests" : [
        {
            "testKey" : "DEMO-6",
            "start" : "2014-08-30T11:47:35+01:00",
            "finish" : "2014-08-30T11:50:56+01:00",
            "comment" : "Successful execution",
            "status" : "PASSED"
        }
     ]
}
Tip
titleExample Request

curl -H "Content-Type: application/json" -X POST -H "Authorization: Bearer $token"  --data @"data.json" https://xray.cloud.xpand-it.com/api/v1/import/execution

Responses

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

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


400 BAD_REQUEST : application/json : No execution results where provided.

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 /api/v1/import/execution/multipart
Panel
borderColor#ccc
borderStylesolid

Import the execution results present in query variable "executionResults".

Request

Example 1: new Test Execution
Code Block
titleExample Input
{
    "info" : {
        "summary" : "Execution of automated tests for release v1.3",
		"description" : "This execution is automatically created when importing execution results from an external source",
		"version" : "v1.3",
		"user" : "admin",
		"revision" : "1.0.42134",
		"startDate" : "2014-08-30T11:47:35+01:00",
		"finishDate" : "2014-08-30T11:53:00+01:00",
		"testPlanKey" : "DEMO-100",
		"testEnvironments": ["iOS", "Android"]
    },
    "tests" : [
        {
            "testKey" : "DEMO-6",
            "start" : "2014-08-30T11:47:35+01:00",
            "finish" : "2014-08-30T11:50:56+01:00",
            "comment" : "Successful execution",
            "status" : "PASSED"
        },
        {
            "testKey" : "DEMO-7",
            "start" : "2014-08-30T11:51:00+01:00",
            "finish" : "2014-08-30T11:52:30+01:00",
            "comment" : "Execution failed. Example #5 FAIL.",
            "status" : "FAILED",
			"evidences" : [
            	{
                	"data": "iVBORw0KGgoAAAANSUhEUgAABkIAAAO9CAYAAADezXv6AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEn(...base64 file enconding)",
					"filename": "image21.jpg",
                    "contentType": "image/jpeg"
                }
			],
            "examples" : [
                "PASSED",
                "PASSED",
                "PASSED",
                "PASSED",
                "FAILED"
            ],
			"steps": [
                {
                    "status": "PASSED",
					"actualResult:" : "Step Passed with Status Code 200",
                    "comment": "Comment on Test Step Result 1",
                    "evidences" : [
                        {
                            "data": "iVBORw0KGgoAAAANSUhEUgAABkIAAAO9CAYAAADezXv6AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEn(...base64 file enconding)",
							"filename": "image22.jpg",
                            "contentType": "image/jpeg"
                        }
					]
				}
			],
		    "defects" : [
					"DEMO-10",
					"DEMO-11"
		   ]
        }
    ]
}
Code Block
titleInfo JSON (Test Execution)
{
    "fields": {
        "project": {
            "id": "10402"
        },
        "summary": "Brand new Test execution",
        "issuetype": {
            "id": "10007"
        },
        "components" : [
            {
            "name":"Interface"
            },
            {
            "name":"Core"
            }
        ]
    },
	"xrayFields": {
		"testPlanKey": "DEMO-15",
		"environments": ["Chrome", "Windows"]
	}
}
Example 2: update existing Test Execution
Code Block
titleExample Input
{
    "testExecutionKey": "DEMO-1206",
    "info" : {
        "summary" : "Execution of automated tests for release v1.3",
		"description" : "This execution is automatically created when importing execution results from an external source",
		"version" : "v1.3",
		"user" : "admin",
		"revision" : "1.0.42134",
		"startDate" : "2014-08-30T11:47:35+01:00",
		"finishDate" : "2014-08-30T11:53:00+01:00",
		"testPlanKey" : "DEMO-100",
		"testEnvironments": ["iOS", "Android"]
    },
    "tests" : [
        {
            "testKey" : "DEMO-6",
            "start" : "2014-08-30T11:47:35+01:00",
            "finish" : "2014-08-30T11:50:56+01:00",
            "comment" : "Successful execution",
            "status" : "PASSED"
        }
     ]
}
Code Block
titleInfo JSON (Test Execution)
{
    "fields": {
        "project": {
            "id": "10402"
        },
        "summary": "Brand new Test execution",
        "issuetype": {
            "id": "10007"
        },
        "components" : [
            {
            "name":"Interface"
            },
            {
            "name":"Core"
            }
        ]
    },
	"xrayFields": {
		"testPlanKey": "DEMO-15",
		"environments": ["Chrome", "Windows"]
	}
}
Tip
titleExample Request

curl -H "Content-Type: multipart/form-data" -X POST -F info=@issueFields.json -F results=@results.json -H "Authorization: Bearer $token"  https://xray.cloud.xpand-it.com/api/v1/import/execution/multipart

Responses

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

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


400 BAD_REQUEST : application/json : No execution results where provided.

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

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

...