Skip to content

Commit 86878cb

Browse files
author
Luiko Czub
committed
new api - setTestCaseTestSuite #81
1 parent 22d44b5 commit 86878cb

8 files changed

+58
-9
lines changed

Diff for: CHANGES.rst

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ implement 1.9.17 new api interfaces - #76, #82
1313
[platformname=<platformname>], [options=<options>], [devKey=<devKey>])
1414
- getRequirements(<testprojectid>, [testplanid=<testplanid>], [platformid=<platformid>], [devKey=<devKey>])
1515
- getReqCoverage(<testprojectid>, <requirementdocid>, [devKey=<devKey>])
16+
- setTestCaseTestSuite(<testcaseexternalid>, <testsuiteid>, [devKey=<devKey>])
1617

1718
known TL 1.9.17-DEV issues:
1819
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Diff for: example/TestLinkExample.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -264,20 +264,25 @@
264264
newTestCaseID_AA = newTestCase[0]['id']
265265
print("New Test Case '%s' - id: %s" % (NEWTESTCASE_AA, newTestCaseID_AA))
266266

267-
#Creates the test case TC_B with state rework
267+
#Creates the test case TC_B with state rework - in wrong test suite A
268268
myTestLink.initStep("Step action 1", "Step result 1", AUTOMATED)
269269
myTestLink.appendStep("Step action 2", "Step result 2", AUTOMATED)
270270
myTestLink.appendStep("Step action 3", "Step result 3", AUTOMATED)
271271
myTestLink.appendStep("Step action 4", "Step result 4", AUTOMATED)
272272
myTestLink.appendStep("Step action 5", "Step result 5", AUTOMATED)
273273

274-
newTestCase = myTestLink.createTestCase(NEWTESTCASE_B, newTestSuiteID_B,
274+
newTestCase = myTestLink.createTestCase(NEWTESTCASE_B, newTestSuiteID_A,
275275
newProjectID, myTestUserName, "This is the summary of the Test Case B",
276276
preconditions='these are the preconditions', executiontype=AUTOMATED,
277277
status=REWORK, estimatedexecduration=0.5)
278-
print("createTestCase", newTestCase)
278+
print("createTestCase TC-B in TS-A", newTestCase)
279279
newTestCaseID_B = newTestCase[0]['id']
280280
print("New Test Case '%s' - id: %s" % (NEWTESTCASE_B, newTestCaseID_B))
281+
282+
# Move test case TC_B to correct test suite B
283+
tc_b_full_ext_id = myTestLink.getTestCase(newTestCaseID_B)[0]['full_tc_external_id']
284+
response = myTestLink.setTestCaseTestSuite(tc_b_full_ext_id, newTestSuiteID_B)
285+
print("setTestCaseTestSuite TC-B to TS-B" , response)
281286

282287
# Add test cases to test plan - we need the full external id !
283288
# for every test case version 1 is used

Diff for: example/TestLinkExampleGenericApi.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@
261261
newTestCaseID_AA = newTestCase[0]['id']
262262
print("New Test Case '%s' - id: %s" % (NEWTESTCASE_AA, newTestCaseID_AA))
263263

264-
#Creates the test case TC_B with state rework
264+
# Creates the test case TC_B with state rework - in wrong test suite A
265265
steps_tc_b = [
266266
{'step_number' : 1, 'actions' : "Step action 1 -b " ,
267267
'expected_results' : "Step result 1 - b", 'execution_type' : AUTOMATED},
@@ -274,14 +274,19 @@
274274
{'step_number' : 5, 'actions' : "Step action 5 -b " ,
275275
'expected_results' : "Step result 5 - b", 'execution_type' : AUTOMATED}]
276276

277-
newTestCase = myTestLink.createTestCase(NEWTESTCASE_B, newTestSuiteID_B,
277+
newTestCase = myTestLink.createTestCase(NEWTESTCASE_B, newTestSuiteID_A,
278278
newProjectID, myTestUserName, "This is the summary of the Test Case B",
279279
steps_tc_b, preconditions='these are the preconditions',
280280
executiontype=AUTOMATED, status=REWORK, estimatedexecduration=0.5)
281-
print("createTestCase", newTestCase)
281+
print("createTestCase TC-B in TS-A", newTestCase)
282282
newTestCaseID_B = newTestCase[0]['id']
283283
print("New Test Case '%s' - id: %s" % (NEWTESTCASE_B, newTestCaseID_B))
284284

285+
# Move test case TC_B to correct test suite B
286+
tc_b_full_ext_id = myTestLink.getTestCase(testcaseid=newTestCaseID_B)[0]['full_tc_external_id']
287+
response = myTestLink.setTestCaseTestSuite(tc_b_full_ext_id, newTestSuiteID_B)
288+
print("setTestCaseTestSuite TC-B to TS-B" , response)
289+
285290
# Add test cases to test plan - we need the full external id !
286291
# for every test case version 1 is used
287292
tc_version=1

Diff for: src/testlink/testlinkapigeneric.py

+22-1
Original file line numberDiff line numberDiff line change
@@ -1864,7 +1864,28 @@ def getReqCoverage(self):
18641864
18651865
mandatory arg:
18661866
testprojectid - identifies the test project
1867-
requirementdocid - odentifies the requirement
1867+
requirementdocid - identifies the requirement
1868+
1869+
"""
1870+
1871+
# /**
1872+
# *
1873+
# * @param struct $args
1874+
# * @param string $args["devKey"]
1875+
# * @param string $args["testcaseexternalid"] format PREFIX-NUMBER
1876+
# * @param int $args["testsuiteid"]
1877+
# *
1878+
# */
1879+
# public function setTestCaseTestSuite($args)
1880+
1881+
@decoApiCallAddDevKey
1882+
@decoMakerApiCallWithArgs(['testcaseexternalid', 'testsuiteid'], [])
1883+
def setTestCaseTestSuite(self):
1884+
""" move a test case to a different Test Suite
1885+
1886+
mandatory arg:
1887+
testcaseexternalid - identifies the test case
1888+
testsuiteid - identifies the test suite
18681889
18691890
"""
18701891

Diff for: 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.5-dev082'
21-
TL_RELEASE = 'DEV 1.9.17 (github 4aa14ae)'
20+
VERSION = '0.6.5-dev081'
21+
TL_RELEASE = 'DEV 1.9.17 (github e281cbd)'
2222

Diff for: test/utest-offline/testlinkapigeneric_offline_test.py

+6
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,12 @@ def test_getReqCoverage_notCovered(self):
918918
self.assertEqual([], response)
919919
self.assertEqual(self.api.devKey, self.api.callArgs['devKey'])
920920

921+
def test_whatArgs_setTestCaseTestSuite(self):
922+
argsDescription = self.api.whatArgs('setTestCaseTestSuite')
923+
self.assertIn('<testcaseexternalid>,', argsDescription)
924+
self.assertIn('<testsuiteid>,', argsDescription)
925+
926+
921927
if __name__ == "__main__":
922928
#import sys;sys.argv = ['', 'Test.testName']
923929
unittest.main()

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

+5
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,11 @@ def test_getReqCoverage_unknownID(self):
487487
self.client.getReqCoverage(
488488
'40000712 project', '40000721 req')
489489

490+
def test_setTestCaseTestSuite_unknownID(self):
491+
with self.assertRaisesRegex(TLResponseError, '5040.*TC-40000712'):
492+
self.client.setTestCaseTestSuite(
493+
'TC-40000712', '40000713 suite')
494+
490495

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

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

+6
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,12 @@ def test_getReqCoverage_unknownID(self):
472472
with self.assertRaisesRegex(TLResponseError, '7000.*40000712'):
473473
self.client.getReqCoverage(
474474
'40000712 project', '40000721 req')
475+
476+
def test_setTestCaseTestSuite_unknownID(self):
477+
with self.assertRaisesRegex(TLResponseError, '5040.*TC-40000712'):
478+
self.client.setTestCaseTestSuite(
479+
'TC-40000712', '40000713 suite')
480+
475481

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

0 commit comments

Comments
 (0)