Skip to content

Commit 3ea8089

Browse files
author
Luiko Czub
committed
new api method assignRequirements() #14
1 parent 4919feb commit 3ea8089

File tree

6 files changed

+49
-0
lines changed

6 files changed

+49
-0
lines changed

Diff for: CHANGES.rst

+7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ new TestlinkAPIGeneric and TestlinkAPIClient api methods
2222
- getUserByLogin(), getUserByID()
2323
- deleteExecution()
2424
- setTestCaseExecutionType()
25+
- assignRequirements()
26+
27+
Known TL 1.9.9 limitations:
28+
29+
- 6202 assignRequirements() calls assign_to_tcase() without author_id
30+
- 6197 MSSQL - 1.9.8 Upgrade - req_coverage table
31+
- 6193 POSTGRESQL - 1.9.8 Upgrade - req_coverage table
2532

2633
TestLink-API-Python-client release notes v0.4.7 (Jan. 2014)
2734
-----------------------------------------------------------

Diff for: example/TestLinkExample.py

+5
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,11 @@
601601
# add png file as Attachemnt to a requirement.
602602
print "uploadRequirementAttachment", "Sorry currently no testdata"
603603

604+
# add requirements to testcase AA
605+
# response = myTestLink.assignRequirements(tc_aa_full_ext_id, newProjectID,
606+
# [{'req_spec' : 6729, 'requirements' : [6731]},
607+
# {'req_spec' : 6733, 'requirements' : [6735, 6737]}])
608+
print "assignRequirements", "Sorry currently no testdata"
604609

605610

606611

Diff for: example/TestLinkExampleGenericApi.py

+6
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,12 @@
512512
# add png file as Attachemnt to a requirement.
513513
print "uploadRequirementAttachment", "Sorry currently no testdata"
514514

515+
# add requirements to testcase AA
516+
# response = myTestLink.assignRequirements(tc_aa_full_ext_id, newProjectID,
517+
# [{'req_spec' : 6729, 'requirements' : [6731]},
518+
# {'req_spec' : 6733, 'requirements' : [6735, 6737]}])
519+
print "assignRequirements", "Sorry currently no testdata"
520+
515521
print ""
516522
print "Number of Projects in TestLink: %i " % len(myTestLink.getProjects())
517523
print ""

Diff for: src/testlink/testlinkapigeneric.py

+17
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,23 @@ def getFirstLevelTestSuitesForTestProject(self):
321321
# */
322322
# public function assignRequirements($args)
323323

324+
@decoApiCallAddDevKey
325+
@decoMakerApiCallWithArgs(['testcaseexternalid', 'testprojectid',
326+
'requirements'])
327+
def assignRequirements(self):
328+
""" Assign Requirements to a test case
329+
It is possible to assign multiple requirements, belonging to different
330+
requirement specifications. (the internal IDs must be known!)
331+
332+
Argument REQUIREMENTS expects an array of dictionaries, example:
333+
.assignRequirements('GPROAPI4-2', 6652,
334+
[{'req_spec' : 6729, 'requirements' : [6731]},
335+
{'req_spec' : 6733, 'requirements' : [6735, 6737]}])
336+
This would assign to testcase 'GPROAPI4-2' (in testproject with id 6652)
337+
a) requirement with ID 6731 of requirement spec 6729 AND
338+
b) requirements with ID 6735 and 6737 of requirement spec 6733
339+
"""
340+
324341
@decoApiCallAddDevKey
325342
@decoMakerApiCallWithArgs([], ['testcaseid', 'testcaseexternalid'])
326343
def getTestCaseAttachments(self):

Diff for: test/utest-online/testlinkapi_online_test.py

+7
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,13 @@ def test_deleteExecution_unknownKey(self):
281281
def test_setTestCaseExecutionType_unknownID(self):
282282
with self.assertRaisesRegexp(TLResponseError, '7000.*4712'):
283283
self.client.setTestCaseExecutionType('N-4711', 1, 4712, 1)
284+
285+
def test_assignRequirements_unknownID(self):
286+
with self.assertRaisesRegexp(TLResponseError, '7000.*4712'):
287+
self.client.assignRequirements('N-4711', 4712,
288+
[{'req_spec' : 4713, 'requirements' : [4714, 4717]},
289+
{'req_spec' : 4723, 'requirements' : [4725]}])
290+
284291

285292

286293
if __name__ == "__main__":

Diff for: test/utest-online/testlinkapigeneric_online_test.py

+7
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,13 @@ def test_setTestCaseExecutionType_unknownID(self):
299299
with self.assertRaisesRegexp(TLResponseError, '7000.*4712'):
300300
self.client.setTestCaseExecutionType('N-4711', 1, 4712, 1)
301301

302+
def test_assignRequirements_unknownID(self):
303+
with self.assertRaisesRegexp(TLResponseError, '7000.*4712'):
304+
self.client.assignRequirements('N-4711', 4712,
305+
[{'req_spec' : 4713, 'requirements' : [4714, 4717]},
306+
{'req_spec' : 4723, 'requirements' : [4725]}])
307+
308+
302309

303310
if __name__ == "__main__":
304311
#import sys;sys.argv = ['', 'Test.testName']

0 commit comments

Comments
 (0)