Skip to content

Commit 5146232

Browse files
author
Luiko Czub
committed
new api method getTestCaseBugs #30
1 parent eca91f9 commit 5146232

7 files changed

+125
-9
lines changed

CHANGES.rst

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
11
Changes in TestLink-API-Python-client Source Distribution
22
=========================================================
33

4+
TestLink-API-Python-client UNDER DEVELOP v0.5.2
5+
-----------------------------------------------------------
6+
support for future TL 1.9.12 release
7+
8+
implement 1.9.12 new api - getTestCaseBugs #30
9+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10+
11+
new TestlinkAPIGeneric and TestlinkAPIClient api method
12+
13+
- getTestCaseBugs(<testplanid>,
14+
[testcaseid]=<testcaseid>], [testcaseexternalid=<testcaseexternalid>],
15+
[buildid=<buildid>], [buildname=<buildname>], [platformid=<platformid>],
16+
[platformname=<platformname>], [devKey=<devKey>])
17+
18+
examples see `<example/TestLinkExample.py>`_
19+
20+
421
TestLink-API-Python-client release notes v0.5.1 (Aug. 2014)
522
------------------------------------------------------------
6-
support for TestLink release 1.9.11
723

824
implement 1.9.11 api change - getLastExecutionResult #27
925
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

example/TestLinkExample.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -429,13 +429,24 @@
429429
buildname=NEWBUILD_A, platformname=NEWPLATFORM_B)
430430
print "assignTestCaseExecutionTask", response
431431

432+
# get bugs for test case TC_AA in test plan A - state TC not executed
433+
response = myTestLink.getTestCaseBugs(newTestPlanID_A,
434+
testcaseexternalid=tc_aa_full_ext_id)
435+
print "getTestCaseBugs TC_AA in TP_A (TC is not executed)", response
436+
432437
# report Test Case Results for platform 'Big Bird'
433438
# TC_AA failed, build should be guessed, TC identified with external id
434439
newResult = myTestLink.reportTCResult(None, newTestPlanID_A, None, 'f', '', guess=True,
435440
testcaseexternalid=tc_aa_full_ext_id,
436441
platformname=NEWPLATFORM_A)#, devKey='361451a1670cb31d127611262ed1a46d')
437442
print "reportTCResult", newResult
438443
newResultID_AA = newResult[0]['id']
444+
445+
# get bugs for test case TC_AA in test plan A - state TC is executed
446+
response = myTestLink.getTestCaseBugs(newTestPlanID_A,
447+
testcaseexternalid=tc_aa_full_ext_id)
448+
print "getTestCaseBugs TC_AA in TP_A (TC is executed, no bug)", response
449+
439450
# report Test Case Results for platform 'Small Bird'
440451
# TC_AA passed, build should be guessed, TC identified with external id
441452
newResult = myTestLink.reportTCResult(None, newTestPlanID_A, None, 'p', '', guess=True,
@@ -480,15 +491,19 @@
480491
# TC_B blocked (without platform), explicit build and some notes ,
481492
# TC identified with internal id, report by myTestUserName
482493
newResult = myTestLink.reportTCResult(newTestCaseID_B, newTestPlanID_B, NEWBUILD_B,
483-
'f', "no birds are singing",
494+
'f', "no birds are singing", bugid='007',
484495
user=myTestUserName)
485496
print "reportTCResult", newResult
486497
newResultID_B_f = newResult[0]['id']
487498
newResult = myTestLink.reportTCResult(newTestCaseID_B, newTestPlanID_B, NEWBUILD_B,
488499
'b', "hungry birds blocks the execution",
489-
user=myTestUserName)
500+
bugid='008', user=myTestUserName)
490501
print "reportTCResult", newResult
491502
newResultID_B_b = newResult[0]['id']
503+
# get bugs for test case TC_B in test plan B - state TC is executed with bug
504+
response = myTestLink.getTestCaseBugs(newTestPlanID_B,
505+
testcaseid=newTestCaseID_B)
506+
print "getTestCaseBugs TC_B in TP_B (TC is executed with 2 bugs)", response
492507

493508
# now we make a mistake and commit the same result a second time
494509
# and try to delete this mistake

example/TestLinkExampleGenericApi.py

+19-3
Original file line numberDiff line numberDiff line change
@@ -353,13 +353,24 @@
353353
buildname=NEWBUILD_A, platformname=NEWPLATFORM_B)
354354
print "assignTestCaseExecutionTask", response
355355

356+
# get bugs for test case TC_AA in test plan A - state TC not executed
357+
response = myTestLink.getTestCaseBugs(newTestPlanID_A,
358+
testcaseexternalid=tc_aa_full_ext_id)
359+
print "getTestCaseBugs TC_AA in TP_A (TC is not executed)", response
360+
356361
# report Test Case Results for platform 'Big Bird'
357362
# TC_AA failed, build should be guessed, TC identified with external id
358363
newResult = myTestLink.reportTCResult(newTestPlanID_A, 'f', guess=True,
359364
testcaseexternalid=tc_aa_full_ext_id,
360365
platformname=NEWPLATFORM_A)
361366
print "reportTCResult", newResult
362367
newResultID_AA = newResult[0]['id']
368+
369+
# get bugs for test case TC_AA in test plan A - state TC is executed
370+
response = myTestLink.getTestCaseBugs(newTestPlanID_A,
371+
testcaseexternalid=tc_aa_full_ext_id)
372+
print "getTestCaseBugs TC_AA in TP_A (TC is executed, no bug)", response
373+
363374
# report Test Case Results for platform 'Small Bird'
364375
# TC_AA passed, build should be guessed, TC identified with external id
365376
newResult = myTestLink.reportTCResult(newTestPlanID_A, 'p', guess=True,
@@ -402,17 +413,22 @@
402413
print "assignTestCaseExecutionTask", response
403414

404415
# TC_B in test plan b (without platform)
405-
# first try failed, second blocked - all by user myTestUserName
416+
# first try failed (with bug), second blocked - all by user myTestUserName
406417
newResult = myTestLink.reportTCResult(newTestPlanID_B, 'f',
407-
buildid=newBuildID_B, testcaseid=newTestCaseID_B,
418+
buildid=newBuildID_B, testcaseid=newTestCaseID_B, bugid='007',
408419
notes="no birds are singing", user=myTestUserName)
409420
print "reportTCResult", newResult
410421
newResultID_B_f = newResult[0]['id']
411422
newResult = myTestLink.reportTCResult(newTestPlanID_B, 'b',
412-
buildid=newBuildID_B, testcaseid=newTestCaseID_B,
423+
buildid=newBuildID_B, testcaseid=newTestCaseID_B, bugid='008',
413424
notes="hungry birds blocks the execution", user=myTestUserName)
414425
print "reportTCResult", newResult
415426
newResultID_B_b = newResult[0]['id']
427+
# get bugs for test case TC_B in test plan B - state TC is executed with bug
428+
response = myTestLink.getTestCaseBugs(newTestPlanID_B,
429+
testcaseid=newTestCaseID_B)
430+
print "getTestCaseBugs TC_B in TP_B (TC is executed with 2 bugs)", response
431+
416432

417433
# now we make a mistake and commit the same result a second time
418434
# and try to delete this mistake

src/testlink/testlinkapigeneric.py

+56
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,62 @@ def assignTestCaseExecutionTask(self):
10541054
platform information is required, when test plan has assigned platforms
10551055
"""
10561056

1057+
# /**
1058+
# * Returns all bugs linked to a particular testcase on a test plan.
1059+
# * If there are no filter criteria regarding platform and build,
1060+
# * result will be get WITHOUT checking for a particular platform and build.
1061+
# *
1062+
# * @param struct $args
1063+
# * @param string $args["devKey"]
1064+
# * @param int $args["tplanid"]
1065+
# * @param int $args["testcaseid"]: Pseudo optional.
1066+
# * if does not is present then testcaseexternalid MUST BE present
1067+
# *
1068+
# * @param int $args["testcaseexternalid"]: Pseudo optional.
1069+
# * if does not is present then testcaseid MUST BE present
1070+
# *
1071+
# * @param string $args["platformid"]: optional.
1072+
# * ONLY if not present, then $args["platformname"]
1073+
# * will be analized (if exists)
1074+
# *
1075+
# * @param string $args["platformname"]: optional (see $args["platformid"])
1076+
# *
1077+
# * @param int $args["buildid"]: optional
1078+
# * ONLY if not present, then $args["buildname"] will be analized (if exists)
1079+
# *
1080+
# * @param int $args["buildname"] - optional (see $args["buildid"])
1081+
# *
1082+
# *
1083+
# * @return mixed $resultInfo
1084+
# * if execution found
1085+
# * array that contains a map with these keys:
1086+
# * bugs
1087+
# *
1088+
# * if test case has not been execute,
1089+
# * array('id' => -1)
1090+
# *
1091+
# * @access public
1092+
# */
1093+
# public function getTestCaseBugs($args)
1094+
1095+
@decoApiCallAddDevKey
1096+
@decoMakerApiCallWithArgs(['testplanid' ],
1097+
['testcaseid', 'testcaseexternalid',
1098+
'buildid', 'buildname', 'platformid', 'platformname'])
1099+
def getTestCaseBugs(self):
1100+
""" Returns all bugs linked to a particular testcase on a test plan.
1101+
If there are no filter criteria regarding platform and build,
1102+
result will be get WITHOUT checking for a particular platform and build.
1103+
1104+
1105+
testplanid test plan id
1106+
1107+
args variations: testcaseid - testcaseexternalid (mandatoy!)
1108+
buildid - buildname
1109+
platformid - platformname
1110+
test case information is general mandatory
1111+
"""
1112+
10571113
#
10581114
# public methods for general server calls
10591115
#

src/testlink/version.py

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

20-
VERSION = '0.5.1'
21-
TL_RELEASE = '1.9.11'
20+
VERSION = '0.5.2-dev30'
21+
TL_RELEASE = 'DEV 1.9.12 (gitorious 9ca61c8)'
2222

test/utest-online/testlinkapi_online_test.py

+6
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,12 @@ def test_assignTestCaseExecutionTask_unknownID(self):
298298
buildname='build 4713',
299299
platformname='platform 4714')
300300

301+
def test_getTestCaseBugs_unknownID(self):
302+
with self.assertRaisesRegexp(TLResponseError, '3000.*4711'):
303+
self.client.getTestCaseBugs(4711, testcaseexternalid='TC-4712',
304+
buildname='build 4713',
305+
platformname='platform 4714')
306+
301307

302308

303309
if __name__ == "__main__":

test/utest-online/testlinkapigeneric_online_test.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,14 @@ def test_assignTestCaseExecutionTask_unknownID(self):
349349
with self.assertRaisesRegexp(TLResponseError, '3000.*4711'):
350350
self.client.assignTestCaseExecutionTask('username', 4711, 'TC-4712',
351351
buildname='build 4713',
352-
platformname='platform 4714')
352+
platformname='platform 4714')
353+
354+
def test_getTestCaseBugs_unknownID(self):
355+
with self.assertRaisesRegexp(TLResponseError, '3000.*4711'):
356+
self.client.getTestCaseBugs(4711, testcaseexternalid='TC-4712',
357+
buildname='build 4713',
358+
platformname='platform 4714')
359+
353360
if __name__ == "__main__":
354361
#import sys;sys.argv = ['', 'Test.testName']
355362
unittest.main()

0 commit comments

Comments
 (0)