Mantis Bugtracker          
testlink.org

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005030TestLinkGeneralpublic2012-05-25 14:502012-09-01 19:59
Reportervincent.morin 
Assigned Tofman 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformHPOSHP-UXOS Version11.23
Product Version1.9.3 (2011 Q3 - bug fixing) 
Fixed in Version1.9.4 (2012 Q3 - bug fixing) 
Summary0005030: function getExecutionSet() in testcase.class.php
DescriptionThe function getExecutionSet() is only used in TL with only one of its arguments and not with its 2 optional args.
When used with $filters argument with 'tplan_id' field an error occurred because in the database the field of executions table is named testcase_id.
Steps To ReproduceCreate test testProject, testCases, testPlan, Build, Platform, and execute some testCases.
Create some unit tests function:

    $filters = array('version_id' => null, 'tplan_id' => $this->testPlanID,
                         'platform_id' => $platform_id, 'build_id' => null);
    $options = array('exec_id_order' => 'DESC');
    $aaa = $this->tcase_mgr->getExecutionSet($testcase_id, $filters, $options);
Additional InformationHere is proposed fix:

testcase.class.php:
near line 5094 (TL1.9.3)

before:
        foreach($filterKeys as $key)
        {
            $filterBy[$key] = '';
            if( !is_null($my['filters'][$key]) )
            {
                $itemSet = implode(',', (array)$$key);
                $filterBy[$key] = " AND e.{$key} IN ({$itemSet}) ";
            }
        }

after:
        foreach($filterKeys as $key)
        {
            $filterBy[$key] = '';
            if( !is_null($my['filters'][$key]) )
            {
                    // BUGFIX In table executions column is not named tplan_id but testplan_id
                    $kkk = $my['filters'][$key]; //$$key;
                $itemSet = implode(',', (array) $kkk);
                $key2 = ($key == 'tplan_id') ? 'testplan_id' : $key;
                $key2 = ($key == 'version_id') ? 'tcversion_id' : $key;
                $filterBy[$key] = " AND e.{$key2} IN ({$itemSet}) ";
            }
        }
TagsTO BE FIXED on 2.0
Database (MySQL,Postgres,etc)MySQL
BrowserFirefox
PHP Version
TestCaseID
QA Team - Task Workflow Status
Attached Files

- Relationships

-  Notes
(0016759)
vincent.morin (reporter)
2012-05-25 15:03

I left a bug:
in place of
                $key2 = ($key == 'tplan_id') ? 'testplan_id' : $key;
                $key2 = ($key == 'version_id') ? 'tcversion_id' : $key;
read
                $key2 = ($key == 'tplan_id') ? 'testplan_id' : $key;
                $key2 = ($key == 'version_id') ? 'tcversion_id' : $key2; // <====
(0016761)
fman (administrator)
2012-05-25 15:49

Creating addition variables when not needed only make maintance worst
>> $kkk = $my['filters'][$key]; //$$key;
>> $itemSet = implode(',', (array) $kkk);
$itemSet = implode(',', (array)($my['filters'][$key]));
(0016762)
fman (administrator)
2012-05-25 15:53

>>$key2 = ($key == 'tplan_id') ? 'testplan_id' : $key;
>>$key2 = ($key == 'version_id') ? 'tcversion_id' : $key;

switch($key)
{
  case 'tplan_id':
    $fname = 'testplan_id';
  break;

  case 'version_id':
    $fname = 'testplan_id';
  break;

  default:
    $fname = $key;
  break;
}
$filterBy[$key] = " AND e.{$fname} IN ({$itemSet}) ";
(0016764)
vincent.morin (reporter)
2012-05-25 16:47

I agree.

More:
  case 'version_id':
    $fname = 'testplan_id';
  break;
please note:
1) fix:
    $fname = 'tcversion_id';
2) but this is unuseful (I seen that later) because this case is does exists here but few lines later
So this case should be removed.
(0016766)
fman (administrator)
2012-05-25 17:13

Anyway I've look for getExecutionSet() usage, and seems to be used only on one place => we can change interface
Solution that will be commited filters keys has to be identical to field names on executions table

More seems that tcversion_id was not used => we have copied from other piece of code.

thanks for your help.
(0016768)
fman (administrator)
2012-05-25 17:29

testlink 1.9.4
http://gitorious.org/testlink-ga/testlink-code/commit/4b9e2e36599b56b20bdc0074974e30e3d6861b40 [^]
(0016790)
fman (administrator)
2012-05-28 13:30


I am afraid it remains a bug in testcase.class.php:
near line 5098:
        $filterBy[$key] = " AND e.{$fieldName} IN ({$itemSet}) ";
                   ^^^
$key have been renamed by $fieldName
so should be:
        $filterBy[$fieldName] = " AND e.{$fieldName} IN ({$itemSet}) ";

please confirm I well understand, thanks for support
(0016791)
fman (administrator)
2012-05-28 13:32

thanks, i've not tested => my fault
(0016792)
vincent.morin (reporter)
2012-05-28 13:50

ok, thanks
(0016795)
fman (administrator)
2012-05-29 05:34

http://gitorious.org/testlink-ga/testlink-code/commit/4249e6b386dcac88dcf819af8354fcc1e5269de2 [^]
(0017324)
fman (administrator)
2012-09-01 19:59

1.9.4 released

- Issue History
Date Modified Username Field Change
2012-05-25 14:50 vincent.morin New Issue
2012-05-25 15:03 vincent.morin Note Added: 0016759
2012-05-25 15:49 fman Note Added: 0016761
2012-05-25 15:53 fman Note Added: 0016762
2012-05-25 16:47 vincent.morin Note Added: 0016764
2012-05-25 17:13 fman Note Added: 0016766
2012-05-25 17:29 fman Note Added: 0016768
2012-05-25 17:29 fman Status new => resolved
2012-05-25 17:29 fman Fixed in Version => 1.9.4 (2012 Q3 - bug fixing)
2012-05-25 17:29 fman Resolution open => fixed
2012-05-25 17:29 fman Assigned To => fman
2012-05-25 17:29 fman Tag Attached: TO BE FIXED on 2.0
2012-05-28 13:30 fman Note Added: 0016790
2012-05-28 13:30 fman Status resolved => new
2012-05-28 13:32 fman Note Added: 0016791
2012-05-28 13:50 vincent.morin Note Added: 0016792
2012-05-29 05:34 fman Note Added: 0016795
2012-07-14 07:38 fman Status new => resolved
2012-09-01 19:59 fman Note Added: 0017324
2012-09-01 19:59 fman Status resolved => closed



Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker