Mantis Bugtracker 

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004739TestLinkCustom fields ON FILTERSpublic2011-09-07 20:402013-05-22 20:59
Assigned Tofman 
PlatformOSOS Version
Product Version1.9.3 (2011 Q3 - bug fixing) 
Fixed in Version1.9.5 (2012 Q4 - bug fixing) 
Summary0004739: Custom filed filter does not work for TCs having 2+ versions in Test Specification treeview
DescriptionWe have multiple custom fields (of string value type) for project test cases. Applying a filter on some custom fields in Test Specification tree view works well until test cases have unique version. Adding new test case version which has the same values as previous one for all custom fields causes problem with filtering. The result of filtering is strange but stable. It returns any time the same subset of test cases but some of them do not match filter criteria.
Steps To Reproduce1. Have several custom fields with multiple values for different test cases. Example: FeatureGroup (FACEBOOK, TWITTER, ORKUT), Feature (SAP, MAIL, FEED, FRIENDS).
2. In Test Specification screen, set a filter on these custom fields. Example: FACEBOOK, SAP. Validate that all test cases are shown as expected.
3. Assign them to execution, mark all of them as passed. This is to get all test cases unchangeable.
4. Open s test case with FeatureGroup = FACEBOOK, Feature = SAP. Click Create New Version button and update some text in Summary or Steps. Save new version of the test case.
5. Apply the same filter as before (see step 0000002). In our case, the filter does not work properly. It does not return the changed test case (I think because of the multiple versions). in our case we got as well some other test cases selected by the filter but they do not have at all both FeatureGroup = FACEBOOK, Feature = SAP.
Additional InformationI have tried to find a code responsible for this filtering. It is not easy.
tlTestCaseFilterControl.class.php builds those filters but I did not find a place in code where it builds the SQL query based on selected custom field values. I think the bug is there.
TagsNo tags attached.
Database (MySQL,Postgres,etc)mySQL 5.5.15
BrowserFireFox 4.0
PHP VersionPHP 5.5
QA Team - Task Workflow StatusREADY FOR TESTING
Attached Files

- Relationships
related to 0004712new Filter on custom field does not work on testcases with multiple versions 

-  Notes
mbeluet (reporter)
2011-09-26 12:36

We notice also the problem and that seems to be a bug...

For information we are using Testlink 1.9.3 (we were using Testlink 1.8.5 before).

The problem occurs in Test Specification folder. As we use some customs fields, we tried to use the filter that appears in 1.9.X release.
It appears that the filter seems not to work, depending on the filter choosed on Custom Fields results are not coherent.

It seems to be due to a conception problem in the filter (file lib\functions\, fonction filter_by_cf_values(), line 1466)
In the algorithm, it seems that it don't take into account the possibility of multiple version for a Test Case (as the custom fields is now connected to a Test Case Version and not to a Test Case).
More, If I have several version of the Test case with several values of Custom fields (If the value changed between 2 versions), which value will be taken ?

For me, I think, the conception of the algorithm miss something and maybe you should do a choice for example verify on the last test case version active to be able to have the correct value to filter on.
bcharloup (reporter)
2011-09-27 14:21

I have the same problem with TL 1.9.2 (i spend few time to understand the reason of this strange behaviour of filter on custom fields).
My conclusion is the same than etomberg : "missing" testcase where those with several version.
My solution, for the present time, was to delete old versions of testcase.
Now, with only one version (the last) for each testcase in my testplan, filter on CS works fine.
Nevertheless, if this bug could be corrected, it would be fine.
alexey.kolyanov (reporter)
2011-10-20 12:15
edited on: 2011-10-20 14:35

I can propose a patch that looks working. At least until official solution gets released.
Edit the file /lib/functions/ (I put line numbers from 1.9.3 version).
My file version: * @version CVS: $Id:,v 2010/11/10 11:22:04 amkhullar Exp $
1459: $tables = tlObject::getDBTables(array('cfield_design_values','nodes_hierarchy','tcversions')); // PATCH FOR BUG 0004739: This line modified!
1501: $sql = " /* $debugMsg */ SELECT CFD.value FROM {$tables['cfield_design_values']} CFD," .
                   " {$tables['nodes_hierarchy']} NH" .
                   ", {$tables['tcversions']} TCV" . // PATCH FOR BUG 0004739: This line added!
                   " WHERE CFD.node_id =" .
                   " AND NH.parent_id = {$node['id']} ". // PATCH FOR BUG 0004739: This line modified
                   " AND and "; // PATCH FOR BUG 0004739: This line added!


1531: $sql .= " order by TCV.version desc limit 1"; // PATCH FOR BUG 0004739: This line added!
1532: $rows = $db->fetchRowsIntoMap($sql,'value');
1534: //if there exist as many rows as custom fields to be filtered by
1535: //the tc does meet the criteria
1536: //$passed = (count($rows) == count($cf_hash)) ? true : false; // PATCH FOR BUG 0004739: This line deleted!
1537: $passed = (count($rows) > 0) ? true : false; // PATCH FOR BUG 0004739: This line added!
Last line is added before line "$rows = $db->fetchRowsIntoMap($sql,'value');"
In other words - we use table 'tcversions' to filter by only last TC version.
Sorry for dirty solution. Looks working for me at first look.

UPD: sorry for some fixes, the source logic there was from another dimension :(

alexey.kolyanov (reporter)
2011-10-20 12:36

Notice: This patch does not work for Test Executions - need to change function filter_cf_selection() in the file /lib/functions/testplan.class.php too. Will do that some later.
alexey.kolyanov (reporter)
2011-10-20 14:40

Fix for Test Execution: edit file file /lib/functions/testplan.class.php
2569: foreach ($tp_tcs as $tc_id => $tc_value)
2570: {
2571: // BUGID 2877 - Custom Fields linked to TC versions
2572: $sql = " /* $debugMsg */ SELECT CFD.value FROM {$this->tables['cfield_design_values']} CFD," .
2573: " {$this->tables['nodes_hierarchy']} NH" .
2574: ", {$this->tables['tcversions']} TCV ". // PATCH FOR BUG 0004739: This line added!
2575: " WHERE CFD.node_id = " .
2576: " AND NH.parent_id = {$tc_value['tc_id']} " .
2577: " AND and " . // PATCH FOR BUG 0004739: This line added!
2578: " {$cf_query} " . // PATCH FOR BUG 0004739: This line modified!
2579: " order by TCV.version desc limit 1"; // PATCH FOR BUG 0004739: This line added!
2581: $rows = $this->db->fetchRowsIntoMap($sql,'value');
2582: // if there exist as many rows as custom fields to be filtered by => tc does meet the criteria
2583: //if(count($rows) == $cf_qty) // PATCH FOR BUG 0004739: This line deleted!
2584: if(count($rows) >0) // PATCH FOR BUG 0004739: This line added!
2585: {
2586: $new_tp_tcs[$tc_id] = $tp_tcs[$tc_id];
2587: }
2588: }

Hope it will help someone.
dlatierro (reporter)
2012-12-14 14:13

Hi, I am having the same issue, I try to add the code but couldn't make the filters work correctly.
I will follow up for more suggestions
fman (administrator)
2012-12-14 16:55

update to 1.9.5 and retest
dlatierro (reporter)
2012-12-14 17:05

Are you sure? is not on the README.txt bug fixing list
fman (administrator)
2012-12-14 18:13

we are asking for little help, i.e. confirmation issue is still there, if you have not time is ok. We need a confirmation not a new question.
dlatierro (reporter)
2012-12-14 18:29

No problem, I will set the server and test on the 1.9.5 on Monday
fman (administrator)
2012-12-14 18:35

dlatierro (reporter)
2012-12-17 12:06

I tested and is working :)
I try the filters with String and List custom fields and is working correctly, on Specifications and Execution page.
It seems that the debug query was not commented on Specifications page because is displayed when filter is applied.
Check the screenshot: [^]

Thanks for the effort, I really appreciate it

- Issue History
Date Modified Username Field Change
2011-09-07 20:40 etomberg New Issue
2011-09-07 21:29 fman Relationship added child of 0004712
2011-09-07 21:29 fman Relationship deleted child of 0004712
2011-09-07 21:29 fman Relationship added related to 0004712
2011-09-26 12:36 mbeluet Note Added: 0015851
2011-09-27 14:21 bcharloup Note Added: 0015854
2011-10-04 20:43 fman Category Custom fields => Custom fields ON FILTERS
2011-10-20 12:15 alexey.kolyanov Note Added: 0015908
2011-10-20 12:17 alexey.kolyanov Note Edited: 0015908 View Revisions
2011-10-20 12:36 alexey.kolyanov Note Added: 0015909
2011-10-20 14:35 alexey.kolyanov Note Edited: 0015908 View Revisions
2011-10-20 14:40 alexey.kolyanov Note Added: 0015910
2012-03-21 14:20 lblestel Note Added: 0016465
2012-03-21 14:22 lblestel Note Edited: 0016465 View Revisions
2012-03-22 08:34 lblestel Note Edited: 0016465 View Revisions
2012-03-22 09:31 lblestel Note Deleted: 0016465
2012-12-14 14:13 dlatierro Note Added: 0018055
2012-12-14 16:55 fman Note Added: 0018057
2012-12-14 17:05 dlatierro Note Added: 0018058
2012-12-14 18:13 fman Note Added: 0018059
2012-12-14 18:29 dlatierro Note Added: 0018060
2012-12-14 18:35 fman Note Added: 0018061
2012-12-17 12:06 dlatierro Note Added: 0018068
2012-12-17 16:54 fman Task Workflow Status => READY FOR TESTING
2012-12-17 16:54 fman Status new => resolved
2012-12-17 16:54 fman Fixed in Version => 1.9.5 (2012 Q4 - bug fixing)
2012-12-17 16:54 fman Resolution open => fixed
2012-12-17 16:54 fman Assigned To => fman
2013-05-22 20:59 fman Status resolved => closed

Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker