lczub / TestLink-API-Python-client

A Python client to use the TestLink API
105 stars 63 forks source link

TestLink test case execution not updated with the result but reportTCResult method returns success #79

Closed ghost closed 7 years ago

ghost commented 7 years ago

Could you please advice with the following issue

Using testlink GUI I have checked 1 Enable Test Automation (API keys) 2 Execution type : Automated 3 Test case assigned to Test Plan

I am trying to use the following code to set test result automatically

import testlink

TESTLINK_API_PYTHON_SERVER_URL="http://my_testlink_server/lib/api/xmlrpc/v1/xmlrpc.php" TESTLINK_API_PYTHON_DEVKEY="my_api_key"

tls = testlink.TestLinkHelper(TESTLINK_API_PYTHON_SERVER_URL, TESTLINK_API_PYTHON_DEVKEY).connect(testlink.TestlinkAPIClient) print(tls.getProjects()) tc_info = tls.getTestCase(None, testcaseexternalid='KKP-395') print(tc_info) print(tls.whatArgs('reportTCResult')) result = tls.reportTCResult(testcaseid='my_testid', testplanid='my_testplan', buildname='my_build', status='p', notes='some notes', user='my_user', platformid='1', overwrite=True, steps=[{'step_number' : 1, 'result' : 'p', 'notes' : 'result note for passed step 1'}]) print("reportTCResult result was: %s" %(result))

After excution receive the following result: reportTCResult result was: [{'id': '501', 'message': 'Success!', 'overwrite': True, 'status': True, 'operation': 'reportTCResult'}]

But when I go to TestLink execution the test case result is Not updated Could you please advice what additional setting/action need to be taken to set test case result automatically ?

Thank you!

lczub commented 7 years ago

Hello irynagalytska,

my suggestion is, that you try to run the example https://github.com/lczub/TestLink-API-Python-client/blob/master/example/TestLinkExample.py. It creates an sample projects with test plan , test cases and test executions. If this not work, you can add the output for further analyse.

Your reportTCResult response [{'id': '501', 'message': 'Success!', 'overwrite': True, 'status': True, 'operation': 'reportTCResult'}] looks like you are not working with a TestLink Server version, which supports setting step result via the XMLRPC Api. For example the current TL 1.9.15 returns an additional boolean parameter 'steps': [{'message': 'Success!', 'steps': 'yes!', 'id': '1943', 'status': True, 'operation': 'reportTCResult', 'overwrite': False}]

For further support, it is helpful to know, which TL server version you are using and which TL Py api client version.

Regards Luiko

ghost commented 7 years ago

Hi Luiko, Thank you very much for the prompt attention I am using TL Py api client version 0.6.3 TL server version 1.9.14 In my case the following helped ANSWER the test case result is updated if platformid='1' (not obligatory parameter) is not added e.g.

result = tls.reportTCResult(testcaseid='my_testid', testplanid='my_testplan', buildname='my_build', status='p', notes='some notes') I was just confused that in case platformid='1' is added no error message received but the test case was not actually updated

Thank you very much for your suggestion we probably need to update TL server version to be able set steps result Regards Iryna

lczub commented 7 years ago

Hello Iryna,

good to hear, that you find a solution.

The python client itself reports only an error, if the server returns an error message or an empty result. In your case, the server has return a valid response, so the client has to report this.

One tipp, instead working with internal id arguments like testcaseid , buildid, platformid I try to use the more readable arguments testcaseexternalid , buildname, platformname . This makes it easier to find wrong build / platform combination.

Regards Luiko

ghost commented 7 years ago

Thank you for the tip!