Page 1 of 1

TL API issue

PostPosted: Wed May 07, 2008 2:34 pm
by xavier
Hi testlink team,

First of all, thank you for your good work.
I installed the latest testlink release from CVS, and try to use the TL API.

I write a python script (based on your sample script) which used all available TL API (reportTCResult, getProjects, getProjectTestPlans, getTestCasesForTestSuite, createBuild, getTestCaseIDByName ...)

I used getTestCaseIDByName to retreive the testcaseID then, I used reportTCResult to send the test result.

it seems that getTestCaseIDByName doesn't return the correct id. This function return : id and parentid. When I call reportTCResult, I've got this error:

[{'message': 'No tcid provided. A valid tcid must be provided!', 'code': 110}, {'message': 'LOCALIZE: API_NO_TCASEEXTERNALID', 'code': 110}]

FYI :
- after calling : getTestCaseIDByName:
[{'parent_id': '380', 'id': '381', 'name': 'logs_string'}]
- before calling self.server.tl.reportTCResult(data)
the data is :
{'status': 'p', 'tcid': '381', 'devKey': 'f2a979d533cdd9761434bba60a88e4d8', 'tpid': '415'}
- reportTCResult return :
[{'message': 'No tcid provided. A valid tcid must be provided!', 'code': 110}, {'message': 'LOCALIZE: API_NO_TCASEEXTERNALID', 'code': 110}]

I see in the SQL table "tcversions" the ID "tc_external_id ". Is this ID we must send to reportTCResult ?

Sample of code (which used testlinkapi.py) :
TLclient = CTestlinkAPIClient(testlinkurl, "f2a979d533cdd9761434bba60a88e4d8")
# Retreive the ID of the Project
TLprojecID = TLclient.getProjectIDbyName("MyTestProject")
TLTestPlanID = TLclient.getProjectTestPlanIDByName(TLprojecID, "automatedUnitTests")
TLTestCaseID = TLclient.getTestCaseIDByName("testname1", "suitename1")
result = TLclient.reportTCResult(TLTestCaseID, TLTestPlanID, "p")
print result

In attachment you'll find:
testlinkapi.py : python script with the class 'CTestlinkAPIClient'

Thanks for the help.

PostPosted: Mon May 12, 2008 10:55 am
by havlatm
I see that you already add the issue in tracker. Thanks.