Skip to content

Commit cf1ee16

Browse files
authored
Support for Xray v2.0 GET testruns (atlassian-api#1098)
* Update xray.py Added support for xray api v2.0 to get test runs in different scopes codestyle fixes...
1 parent 9e448cd commit cf1ee16

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

atlassian/xray.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,58 @@ def get_test_runs(self, test_key):
5353
url = self.resource_url("test/{0}/testruns".format(test_key))
5454
return self.get(url)
5555

56+
def get_test_runs_in_context(self,
57+
test_exec_key=None,
58+
test_key=None,
59+
test_plan_key=None,
60+
include_test_fields=None,
61+
saved_filter_id=None,
62+
limit=None,
63+
page=None
64+
):
65+
"""
66+
Retrieves all the Test Runs from a given context.
67+
With this endpoint you can obtain all the Test Runs (paginated)
68+
in one of the following contexts:
69+
* In a Test Execution issue (use testKey to limit to single test)
70+
* In a Test Plan issue
71+
* In a JQL filter that returns several Test Execution issue
72+
In case the Test Run has iterations, steps will not appear.
73+
However, if the Test has parameters but executed one time,
74+
it will show the steps and the parameters info
75+
:param test_exec_key: The Test Execution issue key
76+
:param test_key: The Test issue key
77+
(may only be used when using the "test_exec_key" param)
78+
:param test_plan_key: The Test Plan issue key
79+
:param include_test_fields: List of custom fields of the Test issue
80+
to be return in the responde
81+
(several custom fields can be requested by separating them with ',')
82+
:param saved_filter_id: The Jira JQL filter ID or
83+
name containing Test Executions issues
84+
:param limit: The number of maximum Test Runs to be returned
85+
:param page: The number of the results page
86+
:return: Returns the exported test runs.
87+
"""
88+
if self.api_version == "1.0":
89+
raise Exception("Not supported in API version 1.0")
90+
params = {}
91+
if test_exec_key:
92+
params["testExecKey"] = test_exec_key
93+
if test_key:
94+
params["testKey"] = test_key
95+
if test_plan_key:
96+
params["testPlanKey"] = test_plan_key
97+
if include_test_fields:
98+
params["includeTestFields"] = include_test_fields
99+
if saved_filter_id:
100+
params["savedFilterId"] = saved_filter_id
101+
if limit:
102+
params["limit"] = limit
103+
if page:
104+
params["page"] = page
105+
url = self.resource_url("testruns")
106+
return self.get(url, params=params)
107+
56108
def get_test_runs_with_environment(self, test_key, test_environments):
57109
# TODO
58110
"""

0 commit comments

Comments
 (0)