Question on Python example for API in 1.8 RC3

Discussion and information for XML-RPC interface.

Moderators: Amaradana, TurboPT, TL Developers

Question on Python example for API in 1.8 RC3

Postby johnzan » Thu Jan 29, 2009 5:31 pm


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}

def getInfo(self):

# 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
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,
TestLink user
Posts: 8
Joined: Wed Jan 21, 2009 12:14 pm

Postby AnneGaelle » Wed Feb 11, 2009 2:54 pm

Hello !

I don't know if you got an answer to your problem. I had the same issue some days ago. In fact, it is not :
def reportTCResult(self, tcid, tpid, status):
data = {"devKey":self.devKey, "tcid":tcid, "tpid":tpid, "status":status}


def reportTCResult(self, testcaseid, testplanid, status):
data = {"devKey":self.devKey, "ttestcaseid":testcaseid, "testplanid":testplanid "status":status}

Moreover the testcaseid and testplanid required are those available in your database, look into your "nodes_hierarchy" table, here are the suitable ID (id) for testcaseid and you will find the testplanid in the "testplans" table (id)

Normally it works well !
TestLink user
Posts: 10
Joined: Thu Feb 05, 2009 3:26 pm

Postby fman » Wed Feb 11, 2009 4:25 pm

we work 99% on PHP, then other samples can be not updated (sorry)
Member of TestLink Community
Posts: 3088
Joined: Tue Nov 15, 2005 7:19 am

Return to XML-RPC API

Who is online

Users browsing this forum: No registered users and 3 guests