Skip to content

Commit 2c3ad15

Browse files
ragchuckMartin Zoellner (FG-344)
and
Martin Zoellner (FG-344)
authored
[XRAY] Adding functions for test executions in test plan (atlassian-api#741)
* XRAY: Adding functions for testexecutions in testplan * XRAY: Adding docs for new methods Co-authored-by: Martin Zoellner (FG-344) <Martin.Zoellner@bmw.de>
1 parent 0c752bc commit 2c3ad15

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

atlassian/xray.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,41 @@ def delete_test_from_test_plan(self, test_plan_key, test_key):
275275
url = "rest/raven/1.0/api/testplan/{0}/test/{1}".format(test_plan_key, test_key)
276276
return self.delete(url)
277277

278+
def get_test_executions_with_test_plan(self, test_plan_key):
279+
"""
280+
Retrieve test executions associated with the given test plan.
281+
:param test_plan_key: Test plan key (eg. 'PLAN-001').
282+
:return: Return a list of the test executions associated with the test plan.
283+
"""
284+
url = "rest/raven/1.0/api/testplan/{0}/testexecution".format(test_plan_key)
285+
return self.get(url)
286+
287+
def update_test_plan_test_executions(self, test_plan_key, add=None, remove=None):
288+
"""
289+
Associate test executions with the given test plan.
290+
:param test_plan_key: Test plan key (eg. 'PLAN-001').
291+
:param add: OPTIONAL: List of Test Keys to associate with the test plan (eg. ['TEST-002', 'TEST-003'])
292+
:param remove: OPTIONAL: List of Test Keys no longer associate with the test plan (eg. ['TEST-004', 'TEST-005'])
293+
:return:
294+
"""
295+
if add is None:
296+
add = []
297+
if remove is None:
298+
remove = []
299+
update = {"add": add, "remove": remove}
300+
url = "rest/raven/1.0/api/testplan/{0}/testexecution".format(test_plan_key)
301+
return self.post(url, update)
302+
303+
def delete_test_execution_from_test_plan(self, test_plan_key, test_exec_key):
304+
"""
305+
Remove association of the specified tests execution from the given test plan.
306+
:param test_plan_key: Test plan key (eg. 'PLAN-001').
307+
:param test_exec_key: Test execution Key which should no longer be associate with the test plan (eg. 'TEST-100')
308+
:return:
309+
"""
310+
url = "rest/raven/1.0/api/testplan/{0}/testexecution/{1}".format(test_plan_key, test_exec_key)
311+
return self.delete(url)
312+
278313
# Test Executions API
279314
def get_tests_with_test_execution(self, test_exec_key, detailed=False, limit=None, page=None):
280315
"""

docs/xray.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ Manage Test plans
9999
# Remove association of the specified tests from the given test plan
100100
xray.delete_test_from_test_plan('PLAN-001', 'TEST-001'):
101101
102+
# Retrieve the test executionss associated with the given test plan
103+
xray.get_test_executions_with_test_plan('PLAN-001')
104+
105+
# Associate test executionss with the given test plan
106+
xray.update_test_plan_test_executions('PLAN-001', add=['EXEC-001', 'EXEC-002'], remove=['EXEC-003'])
107+
108+
# Remove association of the specified test executionss from the given test plan
109+
xray.delete_test_execution_from_test_plan('PLAN-001', 'EXEC-001'):
110+
102111
Manage Test Executions
103112
----------------------
104113

0 commit comments

Comments
 (0)