Question on Python example for API in 1.8 RC3
Posted: Thu Jan 29, 2009 5:31 pm
Hi,
I have been trying to run the sample_clients with no joy, specifically the python one.
here is the scriptt (the one provided):
----8<-- start script ------------------------------------
#! /usr/bin/python
"""
Testlink API Sample Python Client implementation
"""
import xmlrpclib
class TestlinkAPIClient:
# substitute your server URL Here
SERVER_URL = "http://localhost/testlink_io/lib/api/xmlrpc.php"
def __init__(self, devKey):
self.server = xmlrpclib.Server(self.SERVER_URL)
self.devKey = devKey
def reportTCResult(self, tcid, tpid, status):
data = {"devKey":self.devKey, "tcid":tcid, "tpid":tpid, "status":status}
return self.server.tl.reportTCResult(data)
def getInfo(self):
return self.server.tl.about()
# substitute your Dev Key Here
client = TestlinkAPIClient("25c6115ae2559c87be3b57027506e880")
# get info about the server
print client.getInfo()
# Substitute for tcid and tpid that apply to your project
result = client.reportTCResult(1132, 56646, "p")
# Typically you'd want to validate the result here and probably do something more useful with it
print "reportTCResult result was: %s" %(result)
----8<-- end script ------------------------------------
When I run this I get the following
----8<-- start script outout ------------------------------------
[root@cactus python]# python clientSample.py
Testlink API Version: 1.0 Beta 4 initially written by Asiel Brumfield
with contributions by TestLink development Team
reportTCResult result was: [{'message': 'No Test Case ID provided. A valid Test Case ID must be provided!', 'code': 110}]
----8<-- end script outout ------------------------------------
The issue is with the line: result = client.reportTCResult(1132, 56646, "p")
How/Where can I find/get the values referenced in the comment:
# Substitute for tcid and tpid that apply to your project
Thanks for any help,
J.
I have been trying to run the sample_clients with no joy, specifically the python one.
here is the scriptt (the one provided):
----8<-- start script ------------------------------------
#! /usr/bin/python
"""
Testlink API Sample Python Client implementation
"""
import xmlrpclib
class TestlinkAPIClient:
# substitute your server URL Here
SERVER_URL = "http://localhost/testlink_io/lib/api/xmlrpc.php"
def __init__(self, devKey):
self.server = xmlrpclib.Server(self.SERVER_URL)
self.devKey = devKey
def reportTCResult(self, tcid, tpid, status):
data = {"devKey":self.devKey, "tcid":tcid, "tpid":tpid, "status":status}
return self.server.tl.reportTCResult(data)
def getInfo(self):
return self.server.tl.about()
# substitute your Dev Key Here
client = TestlinkAPIClient("25c6115ae2559c87be3b57027506e880")
# get info about the server
print client.getInfo()
# Substitute for tcid and tpid that apply to your project
result = client.reportTCResult(1132, 56646, "p")
# Typically you'd want to validate the result here and probably do something more useful with it
print "reportTCResult result was: %s" %(result)
----8<-- end script ------------------------------------
When I run this I get the following
----8<-- start script outout ------------------------------------
[root@cactus python]# python clientSample.py
Testlink API Version: 1.0 Beta 4 initially written by Asiel Brumfield
with contributions by TestLink development Team
reportTCResult result was: [{'message': 'No Test Case ID provided. A valid Test Case ID must be provided!', 'code': 110}]
----8<-- end script outout ------------------------------------
The issue is with the line: result = client.reportTCResult(1132, 56646, "p")
How/Where can I find/get the values referenced in the comment:
# Substitute for tcid and tpid that apply to your project
Thanks for any help,
J.