Answer to TestLink xmlrpc API (via Python) 404 not found

5.3k views Asked by At

Since I don't have enough reputation I could answer the following question:

I'm trying to connect to TestLink via the xmlrpc API. I've set the following in TestLink's config.inc.php:

$tlCfg->api->enabled = TRUE;
$tlCfg->exec_cfg->enabled_test_automation = ENABLED;

and restarted the apache sever. I tried to connect the TestLink server via the python package TestLink-API-Python-client (https://github.com/orenault/TestLink-API-Python-client)

from testlink import TestlinkAPIClient, TestLinkHelper
import sys

URL = 'http://MYSERVER/testlink/lib/api/xmlrpc.php'
DevKey = 'MYKEY'

tl_helper = TestLinkHelper()
myTestLink = tl_helper.connect(TestlinkAPIClient) 
myTestLink.__init__(URL, DEVKEY)

myTestLink.checkDevKey()

And then I receive a TLConnectionError, stating my url, and 404 Not Found...

Does anyone have any idea?

Thanks.

ANSWER: Remove "testlink" from the URL. For example:

URL = 'http://MYSERVER/lib/api/xmlrpc.php'
2

There are 2 answers

0
SomeGuyOnAComputer On

I was able to get the following to work with TestLink 1.9.3 (My company uses an older version - I think the current TL version is 1.9.12). I'm using the latest Python TestLink API version 0.5.2. Please change your server url and dev key for the following code. Also note that I use https instead of http to connect to the xmlrpc file.

import testlink
TESTLINK_API_PYTHON_SERVER_URL="https://testlink/etc/etc/etc"
TESTLINK_API_PYTHON_DEVKEY="someapikey"

tls = testlink.TestLinkHelper( TESTLINK_API_PYTHON_SERVER_URL, TESTLINK_API_PYTHON_DEVKEY ).connect(testlink.TestlinkAPIClient)
print tls.countProjects()
tc_info = tls.getTestCase(None, testcaseexternalid='S-10000')
print tc_info
print tls.whatArgs('createTestPlan')

I also posted it as an issue here

0
parthiban On

Edit testlinkhelper.py file and change the line

"DEFAULT_SERVER_URL  = http://localhost/testlink/lib/api/xmlrpc/v1/xmlrpc.php"

and replace the localhost with your server ip and check the URL in the browser.