Skip to content

Commit 7f0256c

Browse files
author
Luiko Czub
committed
new api method - updateTestSuiteCustomFieldDesignValue #61
1 parent 8ebffc1 commit 7f0256c

File tree

6 files changed

+75
-7
lines changed

6 files changed

+75
-7
lines changed

CHANGES.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,21 @@ TestLink-API-Python-client v0.6.2 - Under Develop
55
------------------------------------------------------------
66
support for TL 1.9.14 release
77

8-
implement 1.9.14 new api interfaces - #53
8+
implement 1.9.14 new api interfaces - #53 #61
99
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1010

1111
new TestlinkAPIGeneric and TestlinkAPIClient api methods
1212

1313
- deleteTestProject(<testprojectprefix>)
14+
- updateTestSuiteCustomFieldDesignValue(<testprojectid>, <testsuiteid>, <customfields>)
1415

1516
examples _`<example/TestLinkExample.py>`_ and
1617
`<example/TestLinkExampleGenericApi.py>`_ now deletes the sample project, if it
1718
already exist.
1819

20+
example _`<example/TestLinkExample_CF_KW.py>`_ shows, how to set and get
21+
customer field values
22+
1923
implement 1.9.14 changed api interfaces - #48 #49 #54 #59
2024
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2125

@@ -75,6 +79,11 @@ TestlinkAPIClient service method listKeywordsForTC() uses now getTestCaseKeyword
7579

7680
- internal change to reduce code complexity
7781

82+
Known TL 1.9.14 limitations:
83+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
84+
85+
- 7282 updateTestSuiteCustomFieldDesignValue() does change customer field values
86+
7887
TestLink-API-Python-client release notes v0.6.1 (Mar. 2015)
7988
------------------------------------------------------------
8089
support for TL 1.9.13 release

example/TestLinkExample_CF_KW.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@
232232
'testprojectid' : newProjectID,
233233
'testcaseexternalid' : newTestCase_B['full_tc_external_id'],
234234
'version' : int(newTestCase_B['version']),
235-
'tcversion_id' : lastResult['tcversion_id'],
235+
'tcversion_number' : lastResult['tcversion_number'],
236236
'executionid' : lastResult['id'],
237237
'linkid' : 779,
238238
'testsuiteid': newTestSuiteID_B,
@@ -242,7 +242,7 @@
242242

243243
# get CustomField Value - TestCase Execution
244244
response = myTestLink.getTestCaseCustomFieldExecutionValue(
245-
'cf_tc_ex_string', args['testprojectid'], args['tcversion_id'],
245+
'cf_tc_ex_string', args['testprojectid'], args['tcversion_number'],
246246
args['executionid'] , args['testplanid'] )
247247
print( "getTestCaseCustomFieldExecutionValue", response )
248248

@@ -273,10 +273,16 @@
273273

274274
# get CustomField Value - TestCase Testplan Design
275275
response = myTestLink.getTestCaseCustomFieldTestPlanDesignValue(
276-
'cf_tc_pd_string', args['testprojectid'], args['tcversion_id'],
276+
'cf_tc_pd_string', args['testprojectid'], args['tcversion_number'],
277277
args['testplanid'], args['linkid'])
278278
print( "getTestCaseCustomFieldTestPlanDesignValue", response )
279279

280+
# update CustomField Value - TestSuite SpecDesign
281+
response = myTestLink.updateTestSuiteCustomFieldDesignValue(
282+
args['testprojectid'], args['testsuiteid'],
283+
{'cf_ts_string' : 'A custom TestSuite value set via api'})
284+
print( "updateTestSuiteCustomFieldDesignValue", response )
285+
280286
# get CustomField Value - TestSuite
281287
response = myTestLink.getTestSuiteCustomFieldDesignValue(
282288
'cf_ts_string', args['testprojectid'], args['testsuiteid'])

src/testlink/testlinkapigeneric.py

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def getBuildsForTestPlan(self):
183183
def getTestSuitesForTestPlan(self):
184184
""" List test suites within a test plan alphabetically
185185
186-
returns an empty list, if no build is assigned """
186+
returns an empty list, if no suite is assigned """
187187

188188
@decoApiCallAddDevKey
189189
@decoMakerApiCallWithArgs(['testprojectname', 'testcaseprefix'],
@@ -1407,6 +1407,44 @@ def removeTestCaseKeywords(self):
14071407
def deleteTestProject(self):
14081408
""" Delete a test project and all related link to other items """
14091409

1410+
# /**
1411+
# * Update value of Custom Field with scope='design'
1412+
# * for a given Test Suite
1413+
# *
1414+
# * @param struct $args
1415+
# * @param string $args["devKey"]: used to check if operation can be done.
1416+
# * if devKey is not valid => abort.
1417+
# *
1418+
# * @param string $args["testsuiteid"]:
1419+
# * @param string $args["testprojectid"]:
1420+
# * @param string $args["customfields"]
1421+
# * contains an map with key:Custom Field Name, value: value for CF.
1422+
# * VERY IMPORTANT: value must be formatted in the way it's written to db,
1423+
# * this is important for types like:
1424+
# *
1425+
# * DATE: strtotime()
1426+
# * DATETIME: mktime()
1427+
# * MULTISELECTION LIST / CHECKBOX / RADIO: se multipli selezione ! come separatore
1428+
# *
1429+
# *
1430+
# * these custom fields must be configured to be writte during execution.
1431+
# * If custom field do not meet condition value will not be written
1432+
# *
1433+
# * @return mixed null if everything ok, else array of IXR_Error objects
1434+
# *
1435+
# * @access public
1436+
# */
1437+
# public function updateTestSuiteCustomFieldDesignValue($args)
1438+
1439+
1440+
@decoApiCallAddDevKey
1441+
@decoMakerApiCallWithArgs(['testprojectid', 'testsuiteid', 'customfields'])
1442+
def updateTestSuiteCustomFieldDesignValue(self):
1443+
""" Update value of Custom Field with scope='design' for a given Test Suite
1444+
1445+
customfields : dictionary with customfields names + values
1446+
VERY IMPORTANT: value must be formatted in the way it's written to db
1447+
"""
14101448

14111449
#
14121450
# internal methods for general server calls

src/testlink/version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
#
1818
# ------------------------------------------------------------------------
1919

20-
VERSION = '0.6.2-dev45'
21-
TL_RELEASE = '1.9.14 github 2a91690'
20+
VERSION = '0.6.2-dev61'
21+
TL_RELEASE = '1.9.14 github 352fd01'
2222

test/utest-online/testlinkapi_generic_online_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,13 @@ def test_createTestPlan_prefix_unknownID(self):
468468
self.client.createTestPlan('plan 40000713',
469469
prefix='TProjectPrefix')
470470

471+
def test_updateTestSuiteCustomFieldDesignValue_unknownID(self):
472+
with self.assertRaisesRegex(TLResponseError, '7000.*40000712'):
473+
self.client.updateTestSuiteCustomFieldDesignValue(
474+
'40000712 TP-ID', '40000711 TS-ID',
475+
{'cf_tc_ex_string' : 'a custom exec value',
476+
'cf_tc_ex_numeric' : 111} )
477+
471478

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

test/utest-online/testlinkapi_online_test.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,14 @@ def test_createTestPlan_prefix_unknownID(self):
453453
with self.assertRaisesRegex(TLResponseError, '7013.*TProjectPrefix'):
454454
self.client.createTestPlan('plan 40000713',
455455
prefix='TProjectPrefix')
456+
457+
def test_updateTestSuiteCustomFieldDesignValue_unknownID(self):
458+
with self.assertRaisesRegex(TLResponseError, '7000.*40000712'):
459+
self.client.updateTestSuiteCustomFieldDesignValue(
460+
'40000712 TP-ID', '40000711 TS-ID',
461+
{'cf_tc_ex_string' : 'a custom exec value',
462+
'cf_tc_ex_numeric' : 111} )
463+
456464

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

0 commit comments

Comments
 (0)