Mantis Bugtracker 

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008687TestLinkRequirement to Test Case Assignmentpublic2019-06-11 08:112019-12-02 06:41
Assigned To 
PlatformOSOS Version
Product Version 
Fixed in Version 
Summary0008687: Create TestProject from old project modifies source project test case assignments
DescriptionDear TestLink Team,

observed in 1.9.20.
When copying a test project (create, create from existing), the copied test cases are assigned to the source requirement instead of the newly created requirement.
The created duplicate requirement in the new project has no test case assigned.
Steps To ReproduceCreate req and test case, assign to each other.
Copy the project and check the requriement- tc assignments in new and old project.
TagsNo tags attached.
Database (MySQL,Postgres,etc)mysql
PHP Version
QA Team - Task Workflow Status
Attached Files

- Relationships

-  Notes
fman (administrator)
2019-06-11 18:08

thanks, I'm going to check

IMPORTANT thing is : from 1.9.18 and up RELATIONS is between REQ VERSION AND TEST CASE VERSION
heju (reporter)
2019-06-16 09:12

Tried again with a fresh database & install, confirming this still happens.

The created duplicate test cases link to the source requirements.
heju (reporter)
2019-11-01 17:36

Dear TestLink team,

I would like to kindly ask if this issue can be reproduced on your side.
In case not I need to further investigate why this happens on my end, maybe some problem in the data base(?)

Thank you in advance!
heju (reporter)
2019-11-10 12:04
edited on: 2019-11-10 12:06

Dear fman,

I did some debugging on this one and wanted to share, maybe it helps to fix this.

In testcase.class.php::copyReqVersionLinksTo: Line 8647
The $mappings are checked by:

if( isset($mappings['req'][$reqID]) ) {

It turns out this is always false as the content of $mappings at this point while test project copy is:
array (size=1)
  0 =>
    array (size=5)
      604 => int 1008
      'req_spec' =>
        array (size=0)
      'req' =>
        array (size=1)
          654 => int 1010
      'req_version' =>
        array (size=1)
          655 => int 1011
      'req_tree' =>
        array (size=1)
          654 =>
            array (size=1)

I think $mappings[0]['req'][$reqID] instead of $mappings['req'][$reqID] would point to the needed data.

The "zero" array holding all the other data is created in testproject.class.php::copy_requirements::line2948

$mappings[] = $op['mappings'];

I wans't quite sure if this "zero" array holding all the data is needed at all, therefore I tried to replace this line by:
$mappings = $op['mappings'];
Now the test project copy function assigns the tcases to the reqs as expected.

Is this the correct fix, or is the "zero" array needed and this fix causes side effects?

heju (reporter)
2019-12-02 06:41

After having a closer look, the above workaround is a bad idea as it does not work if multiple ReqSpecs are on same tree level. Please don't use.

Created a patch that workarounds the issue during the tc-req assignment process:
Tested with multiple ReqSpecs on same and sub- tree level: [^]

- Issue History
Date Modified Username Field Change
2019-06-11 08:11 heju New Issue
2019-06-11 18:08 fman Note Added: 0028926
2019-06-16 09:12 heju Note Added: 0028952
2019-11-01 17:36 heju Note Added: 0029280
2019-11-10 12:04 heju Note Added: 0029288
2019-11-10 12:06 heju Note Edited: 0029288 View Revisions
2019-12-02 06:41 heju Note Added: 0029318

Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker