Hi,
I am trying to update the testresults with xml-rpc and it doesn't update nor return any error. Please help!
mysql> select id, tc_external_id from tcversions where id=49;
+----+----------------+
| id | tc_external_id |
+----+----------------+
| 49 | 2 |
+----+----------------+
mysql> select id, testplan_id from builds where id=2;
+----+-------------+
| id | testplan_id |
+----+-------------+
| 2 | 47 |
+----+-------------+
mysql> select id,testproject_id from testplans;
+----+----------------+
| id | testproject_id |
+----+----------------+
| 47 | 1 |
+----+----------------+
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
$ python testlinkclient.py
Testlink API Version: 1.0 initially written by Asiel Brumfield
with contributions by TestLink development Team
reportTCResult result was: []
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
testlinkclient.py
#! /usr/bin/python
"""
Testlink API Sample Python Client implementation
"""
import xmlrpclib
class TestlinkAPIClient:
# substitute your server URL Here
SERVER_URL = "http://xx.xx.xx.xx/testlink/lib/api/xmlrpc.php"
def __init__(self, devKey):
self.server = xmlrpclib.Server(self.SERVER_URL)
self.devKey = devKey
def reportTCResult(self, tcid, tpid, buildid, status):
#data = {"devKey":self.devKey, "tcid":tcid, "tpid":tpid, "buildid":buildid, "status":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("<devkey>")
# get info about the server
print client.getInfo()
# Substitute for tcid and tpid that apply to your project
result = client.reportTCResult(49, 47, 2, "f")
# Typically you'd want to validate the result here and probably do something more useful with it
print "reportTCResult result was: %s" %(result)
Thank you
Jo
xml-rpc python doesn't update results (1.9.2 - PRAGUE)
Moderators: Amaradana, TurboPT, TL Developers
[SOLVED]: xml-rpc python doesn't update results (1.9.2 - PRA
#! /usr/bin/python
import xmlrpclib
class TestlinkAPIClient:
# substitute your server URL Here
SERVER_URL = "http://xx.xx.xx.xx/testlink/lib/api/xmlrpc.php"
def __init__(self, devKey):
self.server = xmlrpclib.Server(self.SERVER_URL)
self.devKey = devKey
print self.devKey
def reportTCResult(self, tpid, tcid, status, bid, pid):
data ={}
data["devKey"] = self.devKey
data["testcaseid"] = tcid
data["testplanid"] = tpid
data["status"] = status
data["buildid"] = bid
data["platformid"] = pid
return self.server.tl.reportTCResult(data)
def getTestCase(self, tcextid):
data = {}
data["devKey"] = self.devKey
data["testcaseexternalid"] = tcextid
return self.server.tl.getTestCase(data)
# substitute your Dev Key Here
client = TestlinkAPIClient("<devkey>")
# substitute your external id with the prefix if you have any for example ABC-1
tcinfo=(client.getTestCase("<externalid>"))
internaltcid = tcinfo[0]['testcase_id']
# Substitute for tcid, tpid, buildid and plateformid that apply to your project
result = client.reportTCResult(<TPID>, internaltcid, "p", <buildid>, <platformid>)
# Typically you'd want to validate the result here and probably do something more useful with it
print "reportTCResult result was: %s" %(result)
import xmlrpclib
class TestlinkAPIClient:
# substitute your server URL Here
SERVER_URL = "http://xx.xx.xx.xx/testlink/lib/api/xmlrpc.php"
def __init__(self, devKey):
self.server = xmlrpclib.Server(self.SERVER_URL)
self.devKey = devKey
print self.devKey
def reportTCResult(self, tpid, tcid, status, bid, pid):
data ={}
data["devKey"] = self.devKey
data["testcaseid"] = tcid
data["testplanid"] = tpid
data["status"] = status
data["buildid"] = bid
data["platformid"] = pid
return self.server.tl.reportTCResult(data)
def getTestCase(self, tcextid):
data = {}
data["devKey"] = self.devKey
data["testcaseexternalid"] = tcextid
return self.server.tl.getTestCase(data)
# substitute your Dev Key Here
client = TestlinkAPIClient("<devkey>")
# substitute your external id with the prefix if you have any for example ABC-1
tcinfo=(client.getTestCase("<externalid>"))
internaltcid = tcinfo[0]['testcase_id']
# Substitute for tcid, tpid, buildid and plateformid that apply to your project
result = client.reportTCResult(<TPID>, internaltcid, "p", <buildid>, <platformid>)
# Typically you'd want to validate the result here and probably do something more useful with it
print "reportTCResult result was: %s" %(result)
Re: xml-rpc python doesn't update results (1.9.2 - PRAGUE)
what do you think we can do with your second post? pure code without any explanation ? cancel it ?
Re: xml-rpc python doesn't update results (1.9.2 - PRAGUE)
Hi,
First of all would like to Thank the Testlink Community for providing this wonderful tool and that too opensource.
I realize that I didn't write any explanation in my second post. I was so excited it worked and thought of sharing my code in the forum late in the night. In my first post, I have explained what wasn't working. In my second post, I have marked it as "SOLVED" and have put out the code that I used to make it work. I think, it's self-explanatory.
I feel the response to be a little rude. People come to this forum to get help and share their knowledge. I didn't spam. You can very well see that the code is related to testlink and it has comments in it too as to what the code is doing. If you feel that you needed more explanation, you could have asked that politely. I see that you are one of the administrator and you need to respect people who are trying to help. You also have to understand people using forums are from different background.
Canceling the post is not going to do anything other than killing the forum's purpose.
Thank you
Jo
First of all would like to Thank the Testlink Community for providing this wonderful tool and that too opensource.
I realize that I didn't write any explanation in my second post. I was so excited it worked and thought of sharing my code in the forum late in the night. In my first post, I have explained what wasn't working. In my second post, I have marked it as "SOLVED" and have put out the code that I used to make it work. I think, it's self-explanatory.
I feel the response to be a little rude. People come to this forum to get help and share their knowledge. I didn't spam. You can very well see that the code is related to testlink and it has comments in it too as to what the code is doing. If you feel that you needed more explanation, you could have asked that politely. I see that you are one of the administrator and you need to respect people who are trying to help. You also have to understand people using forums are from different background.
Canceling the post is not going to do anything other than killing the forum's purpose.
Thank you
Jo
Re: xml-rpc python doesn't update results (1.9.2 - PRAGUE)
We can start a long an useless discussion and is OK.,
I respect people, and I have just asked what do you think we can do with the post you have done.
I've no time to guess what the code is or a diffe bewteen two posts.
Then do just one thing:
remember that you do not write for yourself but for other people => code without any kind of clear explanation is useless.
I respect people, and I have just asked what do you think we can do with the post you have done.
I've no time to guess what the code is or a diffe bewteen two posts.
Then do just one thing:
remember that you do not write for yourself but for other people => code without any kind of clear explanation is useless.