phpDocumentor TestlinkAPI
[ class tree: TestlinkAPI ] [ index: TestlinkAPI ] [ all elements ]

python client sample

  1. #! /usr/bin/python
  2. """
  3. Testlink API Sample Python 2.x Client implementation
  4. """
  5. import xmlrpclib
  6.  
  7. class TestlinkAPIClient:        
  8.     # substitute your server URL Here
  9.     SERVER_URL = "http://qa/testlink_sandbox/api/xmlrpc.php"
  10.     
  11.     def __init__(self, devKey):
  12.         self.server = xmlrpclib.Server(self.SERVER_URL)
  13.         self.devKey = devKey
  14.  
  15.     def reportTCResult(self, tcid, tpid, status):
  16.         data = {"devKey":self.devKey, "tcid":tcid, "tpid":tpid, "status":status}
  17.         return self.server.tl.reportTCResult(data)
  18.  
  19.     def getInfo(self):
  20.         return self.server.tl.about()
  21.  
  22. # substitute your Dev Key Here
  23. client = TestlinkAPIClient("f2a979d533cdd9761434bba60a88e4d8")
  24. # get info about the server
  25. print client.getInfo()
  26. # Substitute for tcid and tpid that apply to your project
  27. result = client.reportTCResult(1132, 56646, "p")
  28. # Typically you'd want to validate the result here and probably do something more useful with it
  29. print "reportTCResult result was: %s" %(result)

Documentation generated on Fri, 17 Feb 2012 16:07:49 -0500 by phpDocumentor 1.4.4