Mantis Bugtracker          
testlink.org

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007851TestLinkTest Spec. - Search Test Casespublic2017-02-15 16:102017-03-25 15:19
ReporterabIng 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusnewResolutionopen 
PlatformOSwindowsOS Version
Product Version1.9.16 (2016 Q4) 
Fixed in Version 
Summary0007851: Missing test cases while applying a filter on a test suite created as another test suite copy - with custom field - 1.9.16
DescriptionAfter copying a testsuite containing testcases with multiple versions and with custom fields some test cases are lost in a filter.
The steps to reproduce and detailed analysis are in the following sections.

The similar problem 7738 is already fixed, but only partially.
The patch works fine if there is no custom fields in the filter, but fails when there is one.
Steps To Reproduce- Create a CustomField: "Kind Of Test" , type radio, values: Functionnal|Technical
- Create a new project, Assign CustomField "Kind Of Test" to this new project, then create a new test suite
- Create three test cases.
- The first one edit and set the CustomField "Kind Of Test' to "Functional"
- Create a new version for the second test, and edit and set the CustomField "Kind Of Test' to "Functional"
- Keep the last test case with empty value to CustomField "Kind Of Test"
- Filter test cases : CustomField "Kind Of Test" = "Functional" - there are two (1 and 2)
- Copy the test suite - now we have 6 test cases, four of them are the CustomField "Kind Of Test" set to "Functional"
- Filter test cases : CustomField "Kind Of Test" = "Functional" - only three are filtered (1,2 and 4 that is the copy of 1); the test 5 that should be present is missing

 The attached screenshot testlink-filter-custom-fields-copy-paste-pbm.png demonstrates the last step. Here the original test case TC2 with two versions is present in the filter but its copy is missing.
Additional InformationThe reason of the problem seems to be the same as in 7738 - ordering by id instead of ordering by version.
 When test cases are created manually the order is the same. When it is done using copy paste suite operation the order is opposite.

This is reopen of the ticket http://mantis.testlink.org/view.php?id=7808 [^] - after fixing http://mantis.testlink.org/view.php?id=7822 [^] I am able to reproduce it under 1.9.16
TagsNo tags attached.
Database (MySQL,Postgres,etc)tested for MSSQL but rather any
Browserany
PHP Version
TestCaseID
QA Team - Task Workflow Status
Attached Filespng file icon testlink-filter-custom-fields-copy-paste-pbm.PNG [^] (47,841 bytes) 2017-02-15 16:10

- Relationships

-  Notes
(0025996)
abIng (reporter)
2017-02-15 16:19

You can see at https://testlink-ivs-qual.ingenico.com/testlink-1.9.16: [^]
login/password: admin/admin
Project AB003:003
(0026124)
abIng (reporter)
2017-03-17 16:30

I found where the lost test case was killed.
It is at the end of the function filter_by_cf_values in treeMenu.inc.php:

      if (!$passed)
      {
        unset($tcase_tree[$key]);
        $node_deleted = true;
      }

I traced the values $tcase_tree[$key] here and the behaviour is the following:
- all six test cases are processed here
- both variants of TC1 (in TS1 and TS1 copied) are kept - it is OK
- both variants of TC3 are purged - it is also OK
- TC2 of original TS1 is kept but TC2 in copied test suite is purged

Should be: both TC2 kept.

The reason is the result of SQL query
SELECT CFD.value FROM cfield_design_values CFD, nodes_hierarchy NH JOIN ( /* get latest active TC version ID */ SELECT MAX(TCVX.id) AS max_tcv_id, NHTCX.parent_id AS tc_id FROM tcversions TCVX JOIN nodes_hierarchy NHTCX ON NHTCX.id = TCVX.id AND TCVX.active = 1 WHERE NHTCX.parent_id = 1142106 GROUP BY NHTCX.parent_id, TCVX.tc_external_id ) LAVSQL ON NH.id = LAVSQL.max_tcv_id WHERE CFD.node_id = NH.id AND (( CFD.value LIKE '%Functionnal%' AND CFD.field_id = 14 ))

The element is purged when the result is empty.
(0026169)
abIng (reporter)
2017-03-23 15:31

I fixed the problem in testlink-1.9.16\lib\functions\treeMenu.inc.php - see attachment.
The code modified is in function filter_by_cf_values, starting from the line 1027:
      // AB170323 Beg fixing http://mantis.testlink.org/view.php?id=7851 [^]
      //$latest_active_version_sql = " /* get latest active TC version ID */ " .
      // " SELECT MAX(TCVX.id) AS max_tcv_id, NHTCX.parent_id AS tc_id " .
      // " FROM {$tables['tcversions']} TCVX " .
      // " JOIN {$tables['nodes_hierarchy']} NHTCX " .
      // " ON NHTCX.id = TCVX.id AND TCVX.active = 1 " .
      // " WHERE NHTCX.parent_id = {$node['id']} " .
      // " GROUP BY NHTCX.parent_id, TCVX.tc_external_id ";
      //
      //$sql = " /* $debugMsg */ SELECT CFD.value " .
      // " FROM {$tables['cfield_design_values']} CFD, {$tables['nodes_hierarchy']} NH " .
      // " JOIN ( $latest_active_version_sql ) LAVSQL ON NH.id = LAVSQL.max_tcv_id " .
      // " WHERE CFD.node_id = NH.id ";
      $latest_active_version_sql = " /* get latest active TC version ID */ " .
                                   " SELECT MAX(TCVX.version) AS max_tcv_version, NHTCX.parent_id AS tc_id " .
                                   " FROM {$tables['tcversions']} TCVX " .
                                   " JOIN {$tables['nodes_hierarchy']} NHTCX " .
                                   " ON NHTCX.id = TCVX.id AND TCVX.active = 1 " .
                                   " WHERE NHTCX.parent_id = {$node['id']} " .
                                   " GROUP BY NHTCX.parent_id, TCVX.tc_external_id ";
            
      $sql = " /* $debugMsg */ SELECT CFD.value " .
             " FROM {$tables['cfield_design_values']} CFD, {$tables['nodes_hierarchy']} NH " .
             " JOIN ( $latest_active_version_sql ) LAVSQL ON NH.parent_id = LAVSQL.tc_id " .
             " JOIN tcversions TCV ON NH.id = TCV.id " .
             " WHERE TCV.version = LAVSQL.max_tcv_version AND CFD.node_id = NH.id ";
      // AB170323 End fixing http://mantis.testlink.org/view.php?id=7851 [^]
(0026172)
fman (administrator)
2017-03-23 16:58

Ok, but I'm not going to apply this code on 1.9.17
(0026174)
abIng (reporter)
2017-03-24 08:52

Up to you.
Can you explain why?
Something is missing?

- Issue History
Date Modified Username Field Change
2017-02-15 16:10 abIng New Issue
2017-02-15 16:10 abIng File Added: testlink-filter-custom-fields-copy-paste-pbm.PNG
2017-02-15 16:19 abIng Note Added: 0025996
2017-03-17 16:30 abIng Note Added: 0026124
2017-03-23 15:31 abIng Note Added: 0026169
2017-03-23 16:58 fman Note Added: 0026172
2017-03-24 08:52 abIng Note Added: 0026174



Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker