Export Execution Results

Execution results can be exported from Jira through a REST request.


Return the result of the test runs from one of the following options:

  • Test Execution matched by "testExecKey"
  • Tests in Test Plan "testPlanKey"
  • Test Executions in Saved Filter "savedFilterId"

Note that this endpoint may be paginated.

Request

QUERY PARAMETERS

parameter

type

description

testExecKeyString

the test execution to export the test runs

testKeyStringA test in particular that is executed on the test execution. This field is optional and if you indicate this value then you only will get tests result from the run of this particular test
testPlanKeyStringA test plan that contains the tests which's test runs will be exported
savedFilterIdStringThe id of a saved filter of test executions to export the test runs
includeTestFieldsString(Optional) The field ids of the Test fields that will be included in the response (comma separated values)
limitInteger(Optional) Limits the number of results per page. Should be greater or equal to 0 and lower or equal to the maximum set in the Global Configuration.
pageInteger(Optional) Number of the page to be returned. Should be greater or equal to 1.

Example Request

curl -u user:password http://yourserver/rest/raven/1.0/testruns?testExecKey=DEMO-67

curl -u user:password http://yourserver/rest/raven/1.0/testruns?testExecKey=TESTEXEC-46&testKey=TEST-45

curl -u user:password http://yourserver/rest/raven/1.0/testruns?testPlanKey=TESTPLAN-87

curl -u user:password http://yourserver/rest/raven/1.0/testruns?savedFilterId=1376

curl -u user:password http://yourserver/rest/raven/1.0/testruns?testExecKey=TESTEXEC-46&testKey=TEST-45&includeTestFields=summary,customfield_1000

Responses

200 OK : application/octet-stream : Successful.

Example Output
[
  {
    "testKey": "CALC-126",
    "status": "FAIL",
    "type": "Cucumber",
    "start": "2017-05-03T16:49:38+01:00",
    "finish": "2017-05-03T16:49:38+01:00",
    "executedBy": "admin",
    "defects": ["http://yourjirainstance/browse/DEFECT-47"],
    "evidences": [
		{
			"filename":"evidenfile.json",
            "contentType":"application/json",
            "data":"http://yourjirainstance/plugins/servlet/raven/attachment/278/evidenfile.json"
        }
	],
    "results": [
      {
        "name": "HTC One (4.3)",
        "status": "FAIL",
        "duration": 2714468,
        "examples": [
          "PASS",
          "FAIL"
        ],
        "detailExamples": [
          {
            "rank": 1,
            "status": "PASS",
            "duration": 339752,
            "steps": [
              {
                "type": "background",
                "keyword": "Given ",
                "rank": 1,
                "name": "a calculator I just turned on",
                "duration": 36740,
                "status": "PASS"
              },
              {
                "type": "hook",
                "keyword": "Before",
                "rank": 2,
                "name": "FactorialCalculator.setUp()",
                "duration": 33185,
                "status": "PASS"
              },
              {
                "type": "hook",
                "keyword": "After",
                "rank": 3,
                "name": "FactorialCalculator.tearDown()",
                "duration": 13432,
                "status": "PASS"
              },
              {
                "type": "scenario",
                "keyword": "Given ",
                "rank": 4,
                "name": "I have entered 3 into the calculator",
                "duration": 76247,
                "status": "PASS"
              },
              {
                "type": "scenario",
                "keyword": "When ",
                "rank": 5,
                "name": "I press factorial",
                "duration": 80198,
                "status": "PASS"
              },
              {
                "type": "scenario",
                "keyword": "Then ",
                "rank": 6,
                "name": "the result should be 6 on the screen",
                "duration": 99950,
                "status": "PASS"
              }
            ]
          },
          {
            "rank": 2,
            "status": "FAIL",
            "duration": 2374716,
            "steps": [
              {
                "type": "background",
                "keyword": "Given ",
                "rank": 7,
                "name": "a calculator I just turned on",
                "duration": 26074,
                "status": "PASS"
              },
              {
                "type": "hook",
                "keyword": "Before",
                "rank": 8,
                "name": "FactorialCalculator.setUp()",
                "duration": 27654,
                "status": "PASS"
              },
              {
                "type": "hook",
                "keyword": "After",
                "rank": 9,
                "name": "FactorialCalculator.tearDown()",
                "duration": 27654,
                "status": "PASS"
              },
              {
                "type": "scenario",
                "keyword": "Given ",
                "rank": 10,
                "name": "I have entered 4 into the calculator",
                "duration": 89284,
                "status": "PASS"
              },
              {
                "type": "scenario",
                "keyword": "When ",
                "rank": 11,
                "name": "I press factorial",
                "duration": 111012,
                "status": "PASS"
              },
              {
                "type": "scenario",
                "keyword": "Then ",
                "rank": 12,
                "name": "the result should be 65 on the screen",
                "duration": 2093038,
                "errorMessage": "java.lang.AssertionError: \nExpected: is <65L>\n     but: was <24L>\r\n\tat org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)\r\n\tat org.junit.Assert.assertThat(Assert.java:956)\r\n\tat org.junit.Assert.assertThat(Assert.java:923)\r\n\tat com.xpandit.automation.cucumber.FactorialCalculator.theResultShouldBeOutputOnTheScreen(FactorialCalculator.java:47)\r\n\tat ✽.Then the result should be 65 on the screen(com/xpandit/automation/cucumber/2_factorial_error.feature:11)",
                "status": "FAIL"
              }
            ]
          }
        ]
      }
    ],
    "assignee": "admin",
    "testEnvironments": [
      "Android",
      "iOS"
    ]
  }
]
Example Output with includedTestFields
[
  {
    "id": 152,
    "testExecKey": "CALC-193",
    "testKey": "CALC-170",
    "status": "FAIL",
    "type": "MANUAL",
    "start": "2016-01-14T12:10:58Z",
    "finish": "2016-01-14T12:11:17Z",
    "executedBy": "John.Doe",
    "defects": [],
    "evidences": [],
    "steps": [
      {
        "status": "PASS",
        "defects": [],
        "evidences": []
      },
      {
        "status": "PASS",
        "defects": [],
        "evidences": []
      },
      {
        "status": "FAIL",
        "defects": [],
        "evidences": []
      }
    ],
    "assignee": "admin",
    "testEnvironments": [
      "ios"
    ],
    "testIssueFields": {
      "summary": "Export single issue",
      "description": "Test export functionality",
      "customfield_10000": {
        "self": "http://localhost:8080/rest/api/2/customFieldOption/10000",
        "value": "Manual",
        "id": "10000"
      },
      "priority": {
        "self": "http://localhost:8080/rest/api/2/priority/3",
        "iconUrl": "http://localhost:8080/images/icons/priorities/major.svg",
        "name": "Major",
        "id": "3"
      }
    }
  }
]




400 BAD_REQUEST : text/plain : Please check Jira log.

401 UNAUTHORIZED : text/plain : The Xray license is not valid.

500  INTERNAL SERVER ERROR : text/plain : An internal error occurred when generating the output file.


The Cucumber Scenarios Example/Result details (i.e., Hooks, Backgrounds and Steps) are only available for executions done with Xray v2.2.0 and above.

Return the result of the test runs from the Test Execution matched by "testExecKey". Note that this endpoint may be paginated.

Request

QUERY PARAMETERS

parameter

type

description

testExecKeyString

the test execution to export the test runs

testKeyStringA test in particular that is executed on the test execution. This field is optional and if you indicate this value then you only will get tests result from the run of this particular test
limitInteger(Optional) Limits the number of results per page. Should be greater or equal to 0 and lower or equal to the maximum set in the Global Configuration.
pageInteger(Optional) Number of the page to be retuned. Should be greater or equal to 1.



Example Request

curl -u user:password http://yourserver/rest/raven/1.0/execution/result?testExecKey=DEMO-67

curl -u user:password http://yourserver/rest/raven/1.0/execution/result?testExecKey=TESTEXEC-46&testKey=TEST-45

Responses

200 OK : application/octet-stream : Successful.

Example Output
[
  {
    "testKey": "CALC-126",
    "status": "FAIL",
    "type": "Cucumber",
    "start": "2017-05-03T16:49:38+01:00",
    "finish": "2017-05-03T16:49:38+01:00",
    "executedBy": "admin",
    "defects": ["http://yourjirainstance/browse/DEFECT-47"],
    "evidences": [
		{
			"filename":"evidenfile.json",
            "contentType":"application/json",
            "data":"http://yourjirainstance/plugins/servlet/raven/attachment/278/evidenfile.json"
        }
	],
    "results": [
      {
        "name": "HTC One (4.3)",
        "status": "FAIL",
        "duration": 2714468,
        "examples": [
          "PASS",
          "FAIL"
        ],
        "detailExamples": [
          {
            "rank": 1,
            "status": "PASS",
            "duration": 339752,
            "steps": [
              {
                "type": "background",
                "keyword": "Given ",
                "rank": 1,
                "name": "a calculator I just turned on",
                "duration": 36740,
                "status": "PASS"
              },
              {
                "type": "hook",
                "keyword": "Before",
                "rank": 2,
                "name": "FactorialCalculator.setUp()",
                "duration": 33185,
                "status": "PASS"
              },
              {
                "type": "hook",
                "keyword": "After",
                "rank": 3,
                "name": "FactorialCalculator.tearDown()",
                "duration": 13432,
                "status": "PASS"
              },
              {
                "type": "scenario",
                "keyword": "Given ",
                "rank": 4,
                "name": "I have entered 3 into the calculator",
                "duration": 76247,
                "status": "PASS"
              },
              {
                "type": "scenario",
                "keyword": "When ",
                "rank": 5,
                "name": "I press factorial",
                "duration": 80198,
                "status": "PASS"
              },
              {
                "type": "scenario",
                "keyword": "Then ",
                "rank": 6,
                "name": "the result should be 6 on the screen",
                "duration": 99950,
                "status": "PASS"
              }
            ]
          },
          {
            "rank": 2,
            "status": "FAIL",
            "duration": 2374716,
            "steps": [
              {
                "type": "background",
                "keyword": "Given ",
                "rank": 7,
                "name": "a calculator I just turned on",
                "duration": 26074,
                "status": "PASS"
              },
              {
                "type": "hook",
                "keyword": "Before",
                "rank": 8,
                "name": "FactorialCalculator.setUp()",
                "duration": 27654,
                "status": "PASS"
              },
              {
                "type": "hook",
                "keyword": "After",
                "rank": 9,
                "name": "FactorialCalculator.tearDown()",
                "duration": 27654,
                "status": "PASS"
              },
              {
                "type": "scenario",
                "keyword": "Given ",
                "rank": 10,
                "name": "I have entered 4 into the calculator",
                "duration": 89284,
                "status": "PASS"
              },
              {
                "type": "scenario",
                "keyword": "When ",
                "rank": 11,
                "name": "I press factorial",
                "duration": 111012,
                "status": "PASS"
              },
              {
                "type": "scenario",
                "keyword": "Then ",
                "rank": 12,
                "name": "the result should be 65 on the screen",
                "duration": 2093038,
                "errorMessage": "java.lang.AssertionError: \nExpected: is <65L>\n     but: was <24L>\r\n\tat org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)\r\n\tat org.junit.Assert.assertThat(Assert.java:956)\r\n\tat org.junit.Assert.assertThat(Assert.java:923)\r\n\tat com.xpandit.automation.cucumber.FactorialCalculator.theResultShouldBeOutputOnTheScreen(FactorialCalculator.java:47)\r\n\tat ✽.Then the result should be 65 on the screen(com/xpandit/automation/cucumber/2_factorial_error.feature:11)",
                "status": "FAIL"
              }
            ]
          }
        ]
      }
    ],
    "assignee": "admin",
    "testEnvironments": [
      "Android",
      "iOS"
    ]
  }
]


400 BAD_REQUEST : text/plain : Please check Jira log.

401 UNAUTHORIZED : text/plain : The Xray license is not valid.

500  INTERNAL SERVER ERROR : text/plain : An internal error occurred when generating the output file.


The Cucumber Scenarios Example/Result details (i.e., Hooks, Backgrounds and Steps) are only available for executions done with Xray v2.2.0 and above.

  • No labels