Mantis Bugtracker 

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007914TestLinkAPI - XMLRPCpublic2017-04-04 19:512017-04-05 19:48
Assigned To 
PrioritynormalSeverityfeature requestReproducibilityalways
PlatformOSOS Version
Product Version 
Fixed in Version 
Summary0007914: (github code) API-XMLRPC - can getRequirements also return the srs_id - req_specs(id) ?
Descriptioninconsistency between xml-rpc api methods getRequirements and assignRequirements in TL DEV1.9.17 code from github ( commit 4aa14ae )

xml-rpc api method getRequirements returns currently a list with 'id' and 'req_doc_id' field informations and no req_spec(id) info .
sample: [{'id': '15296', 'req_doc_id': 'use-case-01'}, {'id': '15298', 'req_doc_id': 'none-function-01'}]

xml-rpc api method assignRequirements expects beside the requirement(id) as additional information for an assignment also the req_specs(id)
sample: response = myTestLink._callServer('assignRequirements',
                {'devKey' : myTestLink.devKey,
                 'testcaseexternalid' : aTCaseFullExID_B,
                 'testprojectid' : aTProjectID,
                 'requirements' : [{'req_spec' : '15294', 'requirements' : ['15296', '15298' ] }]

If the xml-rpc api method getRequirements also returns the 'srs_id' (stored foreign key inside the requirement table) it would be possible to implement a xml-rpc round trip
a) getRequirements for a test project
b) assignRequirements to test cases of this test project

As additional information also the 'name' information, stored inside the node_type table reference by the requirement, would be also interesting to get.

Alternatively it's the question, why assignRequirements requires as mandatory argument the req_spec(id)?
The final assigment itself and the table req_coverage does not need the req_spec(id)
- $this->reqMgr->assign_to_tcase($req_id,$tcase_id,$this->userID);
TagsNo tags attached.
Database (MySQL,Postgres,etc)postgresql 9.6.2
PHP Version
QA Team - Task Workflow Status
Attached Files

- Relationships

-  Notes
fman (administrator)
2017-04-04 20:37

>> getRequirements returns currently a list with 'id' and 'req_doc_id' field informations and no req_spec(id) info
It's not my choice or my design => feel free to provide a new implementation

why req spec id is needed?
Reading the code you will find that
method checkReqSpecQuality() is used (as explained on code)
   * checks done on
   * Requirements Specification is present on system
   * Requirements Specification belongs to test project

Because before assigning req to test cases, we want to be sure that test cases & requirements belongs to same test project, a check that reqMgr->assign_to_tcase(), does not check.
That's the whole explanation.
lczub (reporter)
2017-04-05 19:11
edited on: 2017-04-05 19:12

Suggestion for a fix is

  function getAllByContext($context,$opt=null)
    $where = "WHERE RSPEC.testproject_id = " . intval($context['tproject_id']);
    $sql = "/* $debugMsg */ " .
// "SELECT DISTINCT,REQ.req_doc_id FROM {$this->tables['requirements']} REQ " .
         "SELECT DISTINCT,REQ.req_doc_id, REQ.srs_id FROM {$this->tables['requirements']} REQ " .
         "JOIN {$this->tables['req_specs']} RSPEC ON = REQ.srs_id ";
This method is called in two places

a) TestLink-Dev\lib\api\xmlrpc\v1\xmlrpc.class.php (1 hit)
    Line 8036: $dummy = $this->reqMgr->getAllByContext($context);
    this is the xml-rpc api method getRequirements this ticket is about
    it would return now a list with 'id', 'req_doc_id' and the 'srs_id', required by assignRequirements
b) TestLink-Dev\lib\results\resultsReqs.php (1 hit)
    Line 51: $reqSetX = (array)$req_mgr->getAllByContext($reqContext);
    I'm not really sure, which gui functionality this influences
    Desktop - Requirements - Generate Requiremnet Specification Document - works
    Test Reports - Requirements based Report - works also

fman (administrator)
2017-04-05 19:32

I completely disagree with this approach, if needed create a NEW method no matter in this case if code will be duplicated, instead of the risk to create regressions isssues.
lczub (reporter)
2017-04-05 19:48

thats the reason why I do not wanted to realise a php change directly, as you mentioned above. ignore this cr ticket and close it.

I will still just support your xml rpc functionalities on the python client site

- Issue History
Date Modified Username Field Change
2017-04-04 19:51 lczub New Issue
2017-04-04 20:37 fman Note Added: 0026244
2017-04-04 20:37 fman Status new => feedback
2017-04-05 19:11 lczub Note Added: 0026247
2017-04-05 19:11 lczub Status feedback => new
2017-04-05 19:12 lczub Note Edited: 0026247 View Revisions
2017-04-05 19:32 fman Note Added: 0026248
2017-04-05 19:48 lczub Note Added: 0026249

Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker