3
3
TestLinkAPI - v0.20
4
4
Created on 5 nov. 2011
5
5
@author: Olivier Renault ([email protected] )
6
-
6
+ @author: kereval.com
7
7
Initialy based on the James Stock testlink-api-python-client R7.
8
-
8
+
9
+ Updated by Kereval to support testCase Reporting and File attachment to test execution
9
10
10
11
"""
11
12
import xmlrpclib
@@ -329,6 +330,16 @@ def createTestCase(self, *args):
329
330
return ret
330
331
331
332
def reportTCResult (self , testcaseid , testplanid , buildid , status , notes ):
333
+ """
334
+ Report execution result
335
+ testcaseid: internal testlink id of the test case
336
+ testplanid: testplan associated with the test case
337
+ buildid: build version of the test case
338
+ status: test verdict ('p': pass,'f': fail,'b': blocked)
339
+
340
+ Return : [{'status': True, 'operation': 'reportTCResult', 'message': 'Success!', 'overwrite': False, 'id': '37'}]
341
+ id correspond to the executionID needed to attach files to a test execution
342
+ """
332
343
argsAPI = {'devKey' : self .devKey ,
333
344
'testcaseid' : testcaseid ,
334
345
'testplanid' : testplanid ,
@@ -337,6 +348,28 @@ def reportTCResult(self, testcaseid, testplanid, buildid, status, notes ):
337
348
'notes' : notes
338
349
}
339
350
return self .server .tl .reportTCResult (argsAPI )
351
+
352
+ def uploadExecutionAttachment (self ,attachmentfile ,executionid ,title ,description ):
353
+ """
354
+ Attach a file to a test execution
355
+ attachmentfile: python file descriptor pointing to the file
356
+ name : name of the file
357
+ title : title of the attachment
358
+ description : description of the attachment
359
+ content type : mimetype of the file
360
+ """
361
+ import mimetypes
362
+ import base64
363
+ import os .path
364
+ argsAPI = {'devKey' : self .devKey ,
365
+ 'executionid' :executionid ,
366
+ 'title' :title ,
367
+ 'filename' :os .path .basename (attachmentfile .name ),
368
+ 'description' :description ,
369
+ 'filetype' :mimetypes .guess_type (attachmentfile .name )[0 ],
370
+ 'content' :base64 .encodestring (attachmentfile .read ())
371
+ }
372
+ return self .server .tl .uploadExecutionAttachment (argsAPI )
340
373
341
374
#
342
375
# ADDITIONNAL FUNCTIONS
0 commit comments