Skip to content

Conversation

@roel0
Copy link

@roel0 roel0 commented Apr 19, 2017

Example is wrong:
Custom field calls need the tcversion_id and not the version number (line 235)

(as a plus, my vim configuration removed unwanted spaces)

@lczub
Copy link
Owner

lczub commented Apr 19, 2017

Hello Roel,

I'm sorry, but your suggestion produces tracebacks in my environment:

  • TL php server 1.9.16 + TL python client 0.6.4

I changed following for the test in TestLinkExample_CF_KW.py

args =  {...
         'tcversion_number' : lastResult['tcversion_number'],
         'tcversion_id' : lastResult['tcversion_id'],
...
# get CustomField Value - TestCase Execution - using tcversion_number
response = myTestLink.getTestCaseCustomFieldExecutionValue(
                'cf_tc_ex_string', args['testprojectid'], args['tcversion_number'],
                args['executionid'] , args['testplanid'] )
print( "getTestCaseCustomFieldExecutionValue tcversion_number", response )

# get CustomField Value - TestCase Execution - using tcversion_id
response = myTestLink.getTestCaseCustomFieldExecutionValue(
                'cf_tc_ex_string', args['testprojectid'], args['tcversion_id'],
                args['executionid'] , args['testplanid'] )
print( "getTestCaseCustomFieldExecutionValue tcversion_id", response )

results are

getTestCaseCustomFieldExecutionValue tcversion_number {'id': '53', 'name': 'cf_tc_ex_string', 'label': 'CF Exec String', 'type': '0', 'possible_values': '', 'default_value': '', 'valid_regexp': '', 'length_min': '0', 'length_max': '0', 'show_on_design': '0', 'enable_on_design': '0', 'show_on_execution': '1', 'enable_on_execution': '1', 'show_on_testplan_design': '0', 'enable_on_testplan_design': '0', 'display_order': '1', 'location': '1', 'required': '0', 'value': 'a custom exec value set via api', 'node_id': '15230'}
Traceback (most recent call last):
  File "D:\git\TestLink-API-Python-client\example\TestLinkExample_CF_KW.py", line 254, in <module>
    args['executionid'] , args['testplanid'] )
  File "D:\git\TestLink-API-Python-client\src\testlink\testlinkdecorators.py", line 140, in wrapperReplaceTLResponseError
    response = methodAPI(self, *argsPositional, **argsOptional)
  File "D:\git\TestLink-API-Python-client\src\testlink\testlinkdecorators.py", line 112, in wrapperAddDevKey
    return methodAPI(self, *argsPositional, **argsOptional)
  File "D:\git\TestLink-API-Python-client\src\testlink\testlinkdecorators.py", line 100, in wrapperWithArgs
    *argsPositional, **argsOptional)
  File "D:\git\TestLink-API-Python-client\src\testlink\testlinkapigeneric.py", line 1515, in callServerWithPosArgs
    self._checkResponse(response, methodNameAPI, argsOptional) 
  File "D:\git\TestLink-API-Python-client\src\testlink\testlinkapigeneric.py", line 1879, in _checkResponse
    response[0]['message'], response[0]['code'])
testlink.testlinkerrors.TLResponseError: 236: No match between following parameters (version/executionid)
getTestCaseCustomFieldExecutionValue({'devKey': '94cc922ff3a62291a7cb9c4adbb60501', 'customfieldname': 'cf_tc_ex_string', 'testprojectid': '15215', 'version': '15230', 'executionid': '2080', 'testplanid': '15216'})

So for my environment, using the tc version number works, using the the tc version id not.

If you take a look into the TL php code xmlrpc.class.php - getTestCaseCustomFieldExecutionValue, you find the sql statement

      $sql = " SELECT id,tcversion_id FROM {$this->tables['executions']} " .
             " WHERE id = " . intval($args[self::$executionIDParamName]) .
             " AND tcversion_number = " . 
             intval($args[self::$versionNumberParamName]);

which shows, that the TL php server really requires the version number as input.

To understand your failure situation, it would be helpful, if you can send the original failure messages before (without) your code changes (and maybe also the logs for the TestLinkExample.py plus TestLinkExample_CF_KW.py examples ).

Regards Luiko

@roel0
Copy link
Author

roel0 commented Apr 20, 2017

Hi,

Weird. I'm using testlink 1.9.13.

As requested:

print tls.getTestCaseCustomFieldExecutionValue("TP_LinkedArtifact",                                                                     
                                                project_id,
                                                latest['tcversion_id'],
                                                latest['id'],
                                                latest['testplan_id'])

Results in:
{'default_value': '', 'enable_on_execution': '1', 'name': 'TP_LinkedArtifact', 'location': '1', 'enable_on_design': '0', 'valid_regexp': '', 'length_min': '0', 'possible_values': '', **'value': '888**', 'label': 'Linked to artifact number', 'show_on_testplan_design': '0', 'display_order': '1', 'length_max': '0', 'show_on_design': '0', 'required': '0', 'show_on_execution': '1', 'type': '1', 'id': '8', 'node_id': '35502', 'enable_on_testplan_design': '0'}

and

print tls.getTestCaseCustomFieldExecutionValue("TP_LinkedArtifact",                                                                     
                                                project_id,
                                                latest['tcversion_number'],
                                                latest['id'],
                                                latest['testplan_id'])

results in
{'default_value': '', 'enable_on_execution': '1', 'name': 'TP_LinkedArtifact', 'location': '1', 'enable_on_design': '0', 'valid_regexp': '', 'length_min': '0', 'possible_values': '', 'value': '', 'label': 'Linked to artifact number', 'show_on_testplan_design': '0', 'display_order': '1', 'length_max': '0', 'show_on_design': '0', 'required': '0', 'show_on_execution': '1', 'type': '1', 'id': '8', 'node_id': '', 'enable_on_testplan_design': '0'}

So both calls work for me, only the one as described in the your example results in an empty value field.
It might be that it was somehow a bug or something because I'm using an older version of testlink.

@roel0
Copy link
Author

roel0 commented Apr 20, 2017

It's indeed a bug on testlink API itself, which has been resolved in the latest version:
http://mantis.testlink.org/view.php?id=7202

@roel0 roel0 closed this Apr 20, 2017
@lczub
Copy link
Owner

lczub commented Apr 21, 2017

Hello Roel,

good to here, that you find the reason for this failure.
Thanks for the analysis.

Cheers Luiko

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants