Skip to content

Commit d054b78

Browse files
author
Luiko Czub
committedMar 4, 2015
new api method addTestCaseKeywords #47
1 parent 6d9836e commit d054b78

File tree

6 files changed

+54
-15
lines changed

6 files changed

+54
-15
lines changed
 

‎CHANGES.rst

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Changes in TestLink-API-Python-client Source Distribution
33

44
TestLink-API-Python-client v0.6.1 - Under Develop
55
------------------------------------------------------------
6-
support for future TL 1.9.13 release
6+
support for TL 1.9.13 release
77

88
Proxy configuration support in TestLinkHelper - pull request #36
99
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -15,7 +15,7 @@ pull request `#36 <https://github.com/lczub/TestLink-API-Python-client/pull/36>`
1515
- Adds a new --proxy option in command line.
1616
- Recognizes "http_proxy" environment variable.
1717

18-
implement 1.9.13 new api methods #32 #41 #42 #44
18+
implement 1.9.13 new api methods #32 #41 #42 #44 #47
1919
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020

2121
new TestlinkAPIGeneric and TestlinkAPIClient api methods
@@ -30,7 +30,9 @@ new TestlinkAPIGeneric and TestlinkAPIClient api methods
3030
- getTestCaseKeywords([testcaseid=<testcaseid>],
3131
[testcaseexternalid=<testcaseexternalid>])
3232

33-
- deleteTestPlan(<testplanid>)
33+
- deleteTestPlan(<testplanid>)
34+
35+
- addTestCaseKeywords(<testcaseexternalid>, <keywords>)
3436

3537
examples see `<example/TestLinkExample.py>`_ and `<example/TestLinkExample_CF_KW.py>`_
3638

‎example/TestLinkExample_CF_KW.py

+14-7
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
- testplan - testcase link
5555
could be requested via api, these example does not work currently.
5656
57-
Script returns keywords from test case TESTCASE_B, if the user has assigned
58-
manually some values.
57+
Script adds keywords KeyWord01 KeyWord02 KeyWord03 to test case TESTCASE_B
58+
and returns the resulting keyword list
5959
6060
"""
6161
from testlink import TestlinkAPIClient, TestLinkHelper
@@ -139,6 +139,17 @@
139139
newTestSuiteID_B=response[2]['id']
140140
newTestSuite = myTestLink.getTestSuiteByID(newTestSuiteID_B)
141141
print( "getTestSuiteByID", newTestSuite )
142+
# get informationen - TestCase_B
143+
response = myTestLink.getTestCaseIDByName(NEWTESTCASE_B, testprojectname=NEWPROJECT)
144+
print( "getTestCaseIDByName", response )
145+
newTestCaseID_B = response[0]['id']
146+
tc_b_full_ext_id = myTestLink.getTestCase(newTestCaseID_B)[0]['full_tc_external_id']
147+
print( "Test Case '%s' - id: %s - ext-id %s" % (NEWTESTCASE_B, newTestCaseID_B, tc_b_full_ext_id) )
148+
# add keywords to TestCase B
149+
response = myTestLink.addTestCaseKeywords(tc_b_full_ext_id,
150+
['KeyWord01', 'KeyWord03', 'KeyWord02'])
151+
print( "addTestCaseKeywords", response )
152+
142153

143154
# list test cases with assigned keywords
144155
response = myTestLink.getTestCasesForTestSuite(newTestSuiteID_B, True,
@@ -148,11 +159,7 @@
148159
'full', getkeywords=True)
149160
print( "getTestCasesForTestSuite (deep=False)", response )
150161

151-
# get informationen - TestCase_B
152-
response = myTestLink.getTestCaseIDByName(NEWTESTCASE_B, testprojectname=NEWPROJECT)
153-
print( "getTestCaseIDByName", response )
154-
newTestCaseID_B = response[0]['id']
155-
print( "Test Case '%s' - id: %s" % (NEWTESTCASE_B, newTestCaseID_B) )
162+
# get informationen - TestCase_B again
156163
newTestCase_B = myTestLink.getTestCase(testcaseid=newTestCaseID_B)[0]
157164
print( "getTestCase", newTestCase_B )
158165

‎src/testlink/testlinkapigeneric.py

+20
Original file line numberDiff line numberDiff line change
@@ -1299,6 +1299,26 @@ def callServerWithPosArgs(self, methodNameAPI, *argsPositional, **argsOptional):
12991299
self._checkResponse(response, methodNameAPI, argsOptional)
13001300
# seams to be ok, so let give them the data
13011301
return response
1302+
1303+
# /**
1304+
# * addTestCaseKeywords
1305+
# * @param struct $args
1306+
# * @param string $args["devKey"]
1307+
# * @param string $args["testcaseexternalid"]
1308+
# * @param array $args["keywords"]: keywords
1309+
# *
1310+
# * @return mixed $resultInfo
1311+
# *
1312+
# * @internal revisions
1313+
# * @since 1.9.13
1314+
# */
1315+
# function addTestCaseKeywords($args)
1316+
1317+
@decoApiCallAddDevKey
1318+
@decoMakerApiCallWithArgs(['testcaseexternalid', 'keywords'], [])
1319+
def addTestCaseKeywords(self):
1320+
""" adds a list of keywords to a given Test case """
1321+
13021322

13031323
#
13041324
# internal methods for general server calls

‎src/testlink/version.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
#
1818
# ------------------------------------------------------------------------
1919

20-
VERSION = '0.6.1-dev43'
21-
TL_RELEASE = 'DEV 1.9.13 (gitorious 0be4cb9)'
20+
VERSION = '0.6.1-dev47'
21+
TL_RELEASE = '1.9.13'
2222

‎test/utest-online/testlinkapi_generic_online_test.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -396,13 +396,17 @@ def test_getTestCaseKeywords_unknownID(self):
396396
self.client.getTestCaseKeywords(testcaseid=40000712)
397397

398398
def test_getTestCaseKeywords_unknownID_external(self):
399-
with self.assertRaisesRegex(TLResponseError, '5040.*40000712'):
399+
with self.assertRaisesRegex(TLResponseError, '5040.*TC-40000712'):
400400
self.client.getTestCaseKeywords(testcaseexternalid='TC-40000712')
401401

402402
def test_deleteTestPlan_unknownID(self):
403403
with self.assertRaisesRegex(TLResponseError, '3000.*40000711'):
404404
self.client.deleteTestPlan(40000711)
405405

406+
def test_getTestCaseKeywords_unknownID(self):
407+
with self.assertRaisesRegex(TLResponseError, '5040.*TC-40000712'):
408+
self.client.addTestCaseKeywords('TC-40000712',
409+
['KeyWord01', 'KeyWord03'])
406410

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

‎test/utest-online/testlinkapi_online_test.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -346,12 +346,18 @@ def test_getTestCaseKeywords_unknownID(self):
346346
self.client.getTestCaseKeywords(testcaseid=40000712)
347347

348348
def test_getTestCaseKeywords_unknownID_external(self):
349-
with self.assertRaisesRegex(TLResponseError, '5040.*40000712'):
349+
with self.assertRaisesRegex(TLResponseError, '5040.*TC-40000712'):
350350
self.client.getTestCaseKeywords(testcaseexternalid='TC-40000712')
351351

352352
def test_deleteTestPlan_unknownID(self):
353353
with self.assertRaisesRegex(TLResponseError, '3000.*40000711'):
354-
self.client.deleteTestPlan(40000711)
354+
self.client.deleteTestPlan(40000711)
355+
356+
def test_getTestCaseKeywords_unknownID(self):
357+
with self.assertRaisesRegex(TLResponseError, '5040.*TC-40000712'):
358+
self.client.addTestCaseKeywords('TC-40000712',
359+
['KeyWord01', 'KeyWord03'])
360+
355361

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

0 commit comments

Comments
 (0)
Please sign in to comment.