function getDataAndScale(&$dbHandler, $argsObj)
{
    $resultsCfg = config_get('results');
    $obj = new stdClass();
    $items = array();
    $totals = null;
    $metricsMgr = new tlTestPlanMetrics($dbHandler);
    $dummy = $metricsMgr->getStatusTotalsByKeywordForRender($argsObj->tplan_id);
    $obj->canDraw = false;
    if (!is_null($dummy)) {
        $dataSet = $dummy->info;
        $obj->canDraw = !is_null($dataSet) && count($dataSet) > 0;
    }
    if ($obj->canDraw) {
        // Process to enable alphabetical order
        foreach ($dataSet as $keyword_id => $elem) {
            $item_descr[$elem['name']] = $keyword_id;
        }
        ksort($item_descr);
        foreach ($item_descr as $name => $keyword_id) {
            $items[] = htmlspecialchars($name);
            foreach ($dataSet[$keyword_id]['details'] as $status => $value) {
                $totals[$status][] = $value['qty'];
            }
        }
    }
    $obj->xAxis = new stdClass();
    $obj->xAxis->values = $items;
    $obj->xAxis->serieName = 'Serie8';
    $obj->series_color = null;
    $obj->scale = new stdClass();
    $obj->scale->maxY = 0;
    $obj->scale->minY = 0;
    $obj->scale->divisions = 0;
    if (!is_null($totals)) {
        // in this array position we will find minimun value after an rsort
        $minPos = count($dataSet) - 1;
        $obj->scale->maxY = 0;
        $obj->scale->minY = 0;
        foreach ($totals as $status => $values) {
            $obj->chart_data[] = $values;
            $obj->series_label[] = lang_get($resultsCfg['status_label'][$status]);
            if (isset($resultsCfg['charts']['status_colour'][$status])) {
                $obj->series_color[] = $resultsCfg['charts']['status_colour'][$status];
            }
        }
    }
    return $obj;
}
function getDataAndScale(&$dbHandler, $argsObj)
{
    $obj = new stdClass();
    $totals = null;
    $resultsCfg = config_get('results');
    $metricsMgr = new tlTestPlanMetrics($dbHandler);
    $dataSet = $metricsMgr->getRootTestSuites($argsObj->tplan_id, $argsObj->tproject_id);
    $dummy = $metricsMgr->getStatusTotalsByTopLevelTestSuiteForRender($argsObj->tplan_id);
    $obj->canDraw = !is_null($dummy->info);
    if (property_exists($argsObj, 'debug')) {
        new dBug($dummy->info);
    }
    if ($obj->canDraw) {
        //// Process to enable alphabetical order
        $item_descr = array_flip($dataSet);
        ksort($item_descr);
        foreach ($item_descr as $name => $tsuite_id) {
            if (isset($dummy->info[$tsuite_id])) {
                $items[] = htmlspecialchars($name);
                $rmap = $dummy->info[$tsuite_id]['details'];
                foreach ($rmap as $key => $value) {
                    $totals[$key][] = $value['qty'];
                }
            } else {
                // make things work, but create log this is not ok
                tlog(__FILE__ . '::' . __FUNCTION__ . 'Missing item: name/id:' . "{$name}/{$tsuite_id}", 'DEBUG');
            }
        }
    }
    $obj->xAxis = new stdClass();
    $obj->xAxis->values = $items;
    $obj->xAxis->serieName = 'Serie8';
    $obj->series_color = null;
    foreach ($totals as $status => $values) {
        $obj->chart_data[] = $values;
        $obj->series_label[] = lang_get($resultsCfg['status_label'][$status]);
        if (isset($resultsCfg['charts']['status_colour'][$status])) {
            $obj->series_color[] = $resultsCfg['charts']['status_colour'][$status];
        }
    }
    return $obj;
}
function initialize_gui(&$dbHandler, &$argsObj)
{
    $manager = new milestone_mgr($dbHandler);
    $gui = new stdClass();
    $gui->user_feedback = null;
    $gui->main_descr = lang_get('title_milestones') . " " . $argsObj->tplan_name;
    $gui->action_descr = null;
    $gui->tplan_name = $argsObj->tplan_name;
    $gui->tplan_id = $argsObj->tplan_id;
    $gui->items = $manager->get_all_by_testplan($argsObj->tplan_id);
    $gui->itemsLive = null;
    if (!is_null($gui->items)) {
        $metrics = new tlTestPlanMetrics($dbHandler);
        $gui->itemsLive = $metrics->getMilestonesMetrics($argsObj->tplan_id, $gui->items);
    }
    $gui->grants = new stdClass();
    $gui->grants->milestone_mgmt = has_rights($dbHandler, "testplan_planning");
    $gui->grants->mgt_view_events = has_rights($dbHandler, "mgt_view_events");
    return $gui;
}
 * Show Test Results over all Builds.
 *
 * @internal revisions
 * @since 1.9.6
 * 
 */
require '../../config.inc.php';
require_once 'common.php';
require_once 'displayMgr.php';
$timerOn = microtime(true);
$templateCfg = templateConfiguration();
$args = init_args($db);
$tplan_mgr = new testplan($db);
$gui = initializeGui($db, $args, $tplan_mgr);
$mailCfg = buildMailCfg($gui);
$metricsMgr = new tlTestPlanMetrics($db);
$dummy = $metricsMgr->getStatusTotalsByTopLevelTestSuiteForRender($args->tplan_id);
if (is_null($dummy)) {
    // no test cases -> no report
    $gui->do_report['status_ok'] = 0;
    $gui->do_report['msg'] = lang_get('report_tspec_has_no_tsuites');
    tLog('Overall Metrics page: no test cases defined');
} else {
    // do report
    $gui->statistics->testsuites = $dummy->info;
    $gui->do_report['status_ok'] = 1;
    $gui->do_report['msg'] = '';
    $items2loop = array('testsuites', 'keywords');
    $keywordsMetrics = $metricsMgr->getStatusTotalsByKeywordForRender($args->tplan_id);
    $gui->statistics->keywords = !is_null($keywordsMetrics) ? $keywordsMetrics->info : null;
    if ($gui->showPlatforms) {
$gui->columnsDefinition->testers = null;
$gui->columnsDefinition->platform = null;
$gui->statistics = new stdClass();
$gui->statistics->keywords = null;
$gui->statistics->testers = null;
$gui->statistics->milestones = null;
$gui->tplan_name = $tplan_info['name'];
$gui->tproject_name = $tproject_info['name'];
$mailCfg = buildMailCfg($gui);
$getOpt = array('outputFormat' => 'map');
$gui->platformSet = $tplan_mgr->getPlatforms($args->tplan_id, $getOpt);
if (is_null($gui->platformSet)) {
    $gui->platformSet = array('');
    $gui->showPlatforms = false;
}
$metricsMgr = new tlTestPlanMetrics($db);
$re = new results($db, $tplan_mgr, $tproject_info, $tplan_info, ALL_TEST_SUITES, ALL_BUILDS);
// ----------------------------------------------------------------------------
$topLevelSuites = $re->getTopLevelSuites();
if (is_null($topLevelSuites)) {
    // no test cases -> no report
    $gui->do_report['status_ok'] = 0;
    $gui->do_report['msg'] = lang_get('report_tspec_has_no_tsuites');
    tLog('Overall Metrics page: no test cases defined');
} else {
    $gui->do_report['status_ok'] = 1;
    $gui->do_report['msg'] = '';
    //$items2loop = array('keywords','assigned_testers');
    $items2loop = array('keywords');
    $kwr = $tplan_mgr->getStatusTotalsByKeyword($args->tplan_id);
    $gui->statistics->keywords = $tplan_mgr->tallyResultsForReport($kwr);
Exemple #6
0
$its = null;
$tproject_mgr = new testproject($db);
$info = $tproject_mgr->get_by_id($args->tproject_id);
$gui->bugInterfaceOn = $info['issue_tracker_enabled'];
if ($info['issue_tracker_enabled']) {
    $it_mgr = new tlIssueTracker($db);
    $its = $it_mgr->getInterfaceObject($args->tproject_id);
    unset($it_mgr);
}
$smarty = new TLSmarty();
$img = $smarty->getImages();
$openBugs = array();
$resolvedBugs = array();
$arrData = array();
$tplan_mgr = new testplan($db);
$metricsMgr = new tlTestPlanMetrics($db);
$tproject_mgr = new testproject($db);
$tplan_info = $tplan_mgr->get_by_id($args->tplan_id);
$tproject_info = $tproject_mgr->get_by_id($args->tproject_id);
unset($tproject_mgr);
// $filters = array();
//$options = array('output' => 'array', 'only_executed' => true, 'details' => 'full');
// $execSet = $tplan_mgr->get_linked_tcversions($args->tplan_id, $filters, $options);
$execSet = (array) $metricsMgr->getLTCVNewGeneration($args->tplan_id, null, array('addExecInfo' => true, 'accessKeyType' => 'index', 'specViewFields' => true, 'testSuiteInfo' => true, 'includeNotRun' => false));
$testcase_bugs = array();
$mine = array();
$l18n = init_labels(array('execution_history' => null, 'design' => null, 'no_linked_bugs' => null));
foreach ($execSet as $execution) {
    $tc_id = $execution['tc_id'];
    $mine[] = $execution['exec_id'];
    $bug_urls = buildBugString($db, $execution['exec_id'], $its, $openBugs, $resolvedBugs);
 * @link        http://www.testlink.org/
 *
 * @internal revisions
 * @since 1.9.10
 *
**/
require_once '../../config.inc.php';
require_once 'common.php';
define('PCHART_PATH', '../../third_party/pchart');
include PCHART_PATH . "/pChart/pData.class";
include PCHART_PATH . "/pChart/pChart.class";
$resultsCfg = config_get('results');
$chart_cfg = $resultsCfg['charts']['dimensions']['overallPieChart'];
$args = init_args($db);
$tplan_mgr = new testplan($db);
$metricsMgr = new tlTestPlanMetrics($db);
$totals = $metricsMgr->getExecCountersByExecStatus($args->tplan_id);
unset($totals['total']);
$values = array();
$labels = array();
foreach ($totals as $key => $value) {
    $values[] = $value;
    $labels[] = lang_get($resultsCfg['status_label'][$key]) . " ({$value})";
    if (isset($resultsCfg['charts']['status_colour'][$key])) {
        $series_color[] = $resultsCfg['charts']['status_colour'][$key];
    }
}
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint($values, "Serie1");
$DataSet->AddPoint($labels, "Serie8");
//$tstart = microtime(true);
//$chronos[] = $tstart; $tnow = end($chronos);reset($chronos);
// Memory metrics
//$mem['usage'][] = memory_get_usage(true); $mem['peak'][] = memory_get_peak_usage(true);
$templateCfg = templateConfiguration();
$tplan_mgr = new testplan($db);
$args = init_args($tplan_mgr);
$gui = initializeGui($db, $args);
// create it here, in order to be able to get tlImages
$smarty = new TLSmarty();
$msg_key = 'no_linked_tcversions';
if ($tplan_mgr->count_testcases($args->tplan_id) > 0) {
    $platformCache = null;
    $msg_key = 'all_testcases_have_tester';
    $cfg = config_get('results');
    $metricsMgr = new tlTestPlanMetrics($db);
    $metrics = $metricsMgr->getNotRunWoTesterAssigned($args->tplan_id, null, null, array('output' => 'array', 'ignoreBuild' => true));
    if (($gui->row_qty = count($metrics)) > 0) {
        $msg_key = '';
        $links = featureLinks($gui->labels, $smarty->getImages());
        $gui->pageTitle .= " - " . $gui->labels['match_count'] . ":" . $gui->row_qty;
        if ($args->show_platforms) {
            $platformCache = $tplan_mgr->getPlatforms($args->tplan_id, array('outputFormat' => 'mapAccessByID'));
        }
        // Collect all tcases id and get all test suite paths
        $targetSet = array();
        foreach ($metrics as &$item) {
            $targetSet[] = $item['tcase_id'];
        }
        $tree_mgr = new tree($db);
        $path_info = $tree_mgr->get_full_path_verbose($targetSet);
*
*
* @internal revisions
* @since 1.9.15
*/
require '../../config.inc.php';
require_once '../../third_party/codeplex/PHPExcel.php';
// Must be included BEFORE common.php
require_once 'common.php';
require_once 'displayMgr.php';
$timerOn = microtime(true);
// will be used to compute elapsed time
$templateCfg = templateConfiguration();
$smarty = new TLSmarty();
$args = init_args($db);
$metricsMgr = new tlTestPlanMetrics($db);
$tplan_mgr =& $metricsMgr;
// displayMemUsage('START' . __FILE__);
list($gui, $labels, $cfg) = initializeGui($db, $args, $smarty->getImages(), $tplan_mgr);
$args->cfg = $cfg;
$mailCfg = buildMailCfg($gui);
// We have faced a performance block due to an environment with
// 700 Builds and 1300 Test Cases on Test Plan
// This created a block on NOT RUN QUERY, but anyway will produce an enormous and
// unmanageable matrix on screen
//
// New way to process:
// ACTIVE Build Qty > 20 => Ask user to select builds he/she wants to use
// Cell Qty = (ACTIVE Build Qty x Test Cases on Test plan) > 2000 => said user I'm sorry
//
if ($gui->activeBuildsQty <= $gui->matrixCfg->buildQtyLimit || $args->do_action == 'result') {
$user = new tlUser($db);
$gui = init_gui($args);
$charset = config_get('charset');
// By default Only open builds are displayed
// we will check if we have open builds
$openBuildsQty = $tplan_mgr->getNumberOfBuilds($args->tplan_id, null, testplan::OPEN_BUILDS);
// not too wise duplicated code, but effective => Quick & Dirty
if ($openBuildsQty <= 0 && !$args->show_closed_builds) {
    $gui->warning_message = lang_get('no_open_builds');
    $gui->tableSet = null;
    $smarty = new TLSmarty();
    $smarty->assign('gui', $gui);
    $smarty->display($templateCfg->template_dir . $templateCfg->default_template);
    exit;
}
$metricsMgr = new tlTestPlanMetrics($db);
$statusCfg = $metricsMgr->getStatusConfig();
$metrics = $metricsMgr->getStatusTotalsByBuildUAForRender($args->tplan_id, array('processClosedBuilds' => $args->show_closed_builds));
$matrix = $metrics->info;
// Here need to work, because all queries consider ONLY ACTIVE STATUS
$option = $args->show_closed_builds ? null : testplan::GET_OPEN_BUILD;
$build_set = $metricsMgr->get_builds($args->tplan_id, testplan::GET_ACTIVE_BUILD, $option);
$names = $user->getNames($db);
// get the progress of the whole build based on executions of single users
$build_statistics = array();
foreach ($matrix as $build_id => $build_execution_map) {
    $build_statistics[$build_id]['total'] = 0;
    $build_statistics[$build_id]['executed'] = 0;
    $build_statistics[$build_id]['total_time'] = 0;
    foreach ($build_execution_map as $user_id => $statistics) {
        // total assigned test cases
/**
 *  only active builds has to be used
 *
 *  @internal revisions
 *
 *  
 */
function getMetrics(&$db, $userObj, $args, $result_cfg, $labels)
{
    $user_id = $args->currentUserID;
    $tproject_id = $args->tproject_id;
    $linked_tcversions = array();
    $metrics = array();
    $tplan_mgr = new testplan($db);
    $show_platforms = false;
    $platforms = array();
    // get all tesplans accessibles  for user, for $tproject_id
    $options = array('output' => 'map');
    $options['active'] = $args->show_only_active ? ACTIVE : TP_ALL_STATUS;
    $test_plans = $userObj->getAccessibleTestPlans($db, $tproject_id, null, $options);
    // Get count of testcases linked to every testplan
    // Hmm Count active and inactive ?
    $linkedItemsQty = $tplan_mgr->count_testcases(array_keys($test_plans), null, array('output' => 'groupByTestPlan'));
    $metricsMgr = new tlTestPlanMetrics($db);
    $show_platforms = false;
    $metrics = array('testplans' => null, 'total' => null);
    $mm =& $metrics['testplans'];
    $metrics['total'] = array('active' => 0, 'total' => 0, 'executed' => 0);
    foreach ($result_cfg['status_label_for_exec_ui'] as $status_code => &$dummy) {
        $metrics['total'][$status_code] = 0;
    }
    $codeStatusVerbose = array_flip($result_cfg['status_code']);
    foreach ($test_plans as $key => &$dummy) {
        // We need to know if test plan has builds, if not we can not call any method
        // that try to get exec info, because you can only execute if you have builds.
        //
        // 20130909 - added active filter
        $buildSet = $tplan_mgr->get_builds($key, testplan::ACTIVE_BUILDS);
        if (is_null($buildSet)) {
            continue;
        }
        $platformSet = $tplan_mgr->getPlatforms($key);
        if (isset($platformSet)) {
            $platforms = array_merge($platforms, $platformSet);
        }
        $show_platforms_for_tplan = !is_null($platformSet);
        $show_platforms = $show_platforms || $show_platforms_for_tplan;
        if (!is_null($platformSet)) {
            $neurus = $metricsMgr->getExecCountersByPlatformExecStatus($key, null, array('getPlatformSet' => true, 'getOnlyActiveTCVersions' => true));
            $mm[$key]['overall']['active'] = $mm[$key]['overall']['executed'] = 0;
            foreach ($neurus['with_tester'] as $platform_id => &$pinfo) {
                $xd =& $mm[$key]['platforms'][$platform_id];
                $xd['tplan_name'] = $dummy['name'];
                $xd['platform_name'] = $neurus['platforms'][$platform_id];
                $xd['total'] = $xd['active'] = $neurus['total'][$platform_id]['qty'];
                $xd['executed'] = 0;
                foreach ($pinfo as $code => &$elem) {
                    $xd[$codeStatusVerbose[$code]] = $elem['exec_qty'];
                    if ($codeStatusVerbose[$code] != 'not_run') {
                        $xd['executed'] += $elem['exec_qty'];
                    }
                    if (!isset($mm[$key]['overall'][$codeStatusVerbose[$code]])) {
                        $mm[$key]['overall'][$codeStatusVerbose[$code]] = 0;
                    }
                    $mm[$key]['overall'][$codeStatusVerbose[$code]] += $elem['exec_qty'];
                    $metrics['total'][$codeStatusVerbose[$code]] += $elem['exec_qty'];
                }
                $mm[$key]['overall']['executed'] += $xd['executed'];
                $mm[$key]['overall']['active'] += $xd['active'];
            }
            unset($neurus);
            $mm[$key]['overall']['total'] = $mm[$key]['overall']['active'];
            $metrics['total']['executed'] += $mm[$key]['overall']['executed'];
            $metrics['total']['active'] += $mm[$key]['overall']['active'];
        } else {
            $mm[$key]['overall'] = $metricsMgr->getExecCountersByExecStatus($key, null, array('getOnlyActiveTCVersions' => true));
            $mm[$key]['overall']['active'] = $mm[$key]['overall']['total'];
            // compute executed
            $mm[$key]['overall']['executed'] = 0;
            foreach ($mm[$key]['overall'] as $status_code => $qty) {
                if ($status_code != 'not_run' && $status_code != 'total' && $status_code != 'active') {
                    $mm[$key]['overall']['executed'] += $qty;
                }
                if ($status_code != 'total' && $status_code != 'active') {
                    if (!isset($metrics['total'][$status_code])) {
                        $metrics['total'][$status_code] = 0;
                    }
                    $metrics['total'][$status_code] += $qty;
                }
            }
            $metrics['total']['executed'] += $mm[$key]['overall']['executed'];
            $metrics['total']['active'] += $mm[$key]['overall']['active'];
            $mm[$key]['platforms'][0] = $mm[$key]['overall'];
            $mm[$key]['platforms'][0]['tplan_name'] = $dummy['name'];
            $mm[$key]['platforms'][0]['platform_name'] = $labels['not_aplicable'];
        }
    }
    // remove duplicate platform names
    $platformsUnique = array();
    foreach ($platforms as $platform) {
        if (!in_array($platform['name'], $platformsUnique)) {
            $platformsUnique[] = $platform['name'];
        }
    }
    return array($metrics, $show_platforms, $platformsUnique);
}
 * @author      franciscom
 * @copyright   2005-2013, TestLink community
 * @link        http://www.testlink.org
 *
 * @internal revisions
 * @since 1.9.10
 *
**/
require_once '../../config.inc.php';
require_once 'common.php';
include "../../third_party/pchart/pChart/pData.class";
include "../../third_party/pchart/pChart/pChart.class";
$resultsCfg = config_get('results');
$chart_cfg = $resultsCfg['charts']['dimensions']['platformPieChart'];
$args = init_args($db);
$metricsMgr = new tlTestPlanMetrics($db);
$dummy = $metricsMgr->getStatusTotalsByPlatformForRender($args->tplan_id);
// if platform has no test case assigned $dummy->info[$args->platform_id] does not exists
if (isset($dummy->info[$args->platform_id])) {
    $totals = $dummy->info[$args->platform_id]['details'];
} else {
    // create empty set
    $status = $metricsMgr->getStatusForReports();
    foreach ($status as $statusVerbose) {
        $totals[$statusVerbose] = array('qty' => 0, 'percentage' => 0);
    }
    unset($status);
}
unset($dummy);
unset($metricsMgr);
$values = array();
/**
 * initialize Gui
 */
function initializeGui(&$dbHandler, &$argsObj, $dateFormat)
{
    new dBug($argsObj);
    /*		$my['filters'] = array('exec_ts_from' => null, 'exec_ts_to' => null,
    							   'assigned_to' => null, 'tester_id' => null,
    							   'keywords' => null, 'builds' => null,
    							   'plaforms' => null, 'top_level_tsuites' => null);
    	
    */
    $reports_cfg = config_get('reportsCfg');
    $tplan_mgr = new tlTestPlanMetrics($dbHandler);
    $tproject_mgr = new testproject($dbHandler);
    $gui = new stdClass();
    $gui->resultsCfg = config_get('results');
    $gui->title = lang_get('query_metrics_report');
    $gui->tplan_id = $argsObj->tplan_id;
    $gui->tproject_id = $argsObj->tproject_id;
    $tplan_info = $tplan_mgr->get_by_id($gui->tplan_id);
    $tproject_info = $tproject_mgr->get_by_id($gui->tproject_id);
    $gui->tplan_name = $tplan_info['name'];
    $gui->tproject_name = $tproject_info['name'];
    $getOpt = array('outputFormat' => 'map');
    $gui->platformSet = $tplan_mgr->getPlatforms($argsObj->tplan_id, $getOpt);
    $gui->showPlatforms = true;
    if (is_null($gui->platformSet)) {
        $gui->platformSet = null;
        $gui->showPlatforms = false;
    } else {
        $filters['platforms'] = array_keys($gui->platformSet);
    }
    // convert starttime to iso format for database usage
    list($gui->startTime, $gui->endTime) = helper2ISO($_REQUEST);
    //die();
    $gui_open = config_get('gui_separator_open');
    $gui_close = config_get('gui_separator_close');
    $gui->str_option_any = $gui_open . lang_get('any') . $gui_close;
    $gui->str_option_none = $gui_open . lang_get('nobody') . $gui_close;
    $gui->search_notes_string = $argsObj->search_notes_string;
    $testsuiteNames = null;
    $everest = $tplan_mgr->getRootTestSuites($gui->tplan_id, $gui->tproject_id, array('output' => 'plain'));
    $tsuites_qty = sizeOf($argsObj->testsuitesSelected);
    $userWantsAll = $tsuits_qty == 0 || $tsuits_qty == count($everest);
    $filters['top_level_tsuites'] = $tsuites_qty == 0 || $tsuites_qty == count($everest) ? null : $argsObj->testsuitesSelected;
    $gui->testsuitesSelected = array();
    foreach ($argsObj->testsuitesSelected as $dmy) {
        $gui->testsuitesSelected[$dmy] = $everest[$dmy]['name'];
    }
    $filters['builds'] = null;
    if (sizeof($argsObj->buildsSelected)) {
        $filters['builds'] = implode(",", $argsObj->buildsSelected);
    }
    $filters['keywords'] = (array) $argsObj->keywordSelected;
    if (in_array(0, $filters['keywords'])) {
        $filters['keywords'] = null;
    }
    // statusForClass is used for results.class.php
    // lastStatus is used to be displayed
    $statusForClass = 'a';
    // amitkhullar - added this parameter to get the latest results.
    $latest_resultset = $argsObj->display->latest_results;
    $assignee = $argsObj->ownerSelected > 0 ? $argsObj->ownerSelected : TL_USER_ANYBODY;
    $tester = $argsObj->executorSelected > 0 ? $argsObj->executorSelected : TL_USER_ANYBODY;
    //$rs = $tplan_mgr->queryMetrics($gui->tplan_id,$filters);
    //new dBug($rs);
    // die();
    //$re = new newResults($dbHandler, $tplan_mgr,$tproject_info,$tplan_info,
    //                  	 $testsuiteIds, $buildsToQuery,
    //                     $argsObj->platformsSelected, $statusForClass,
    //                     $latest_resultset, $argsObj->keywordSelected,
    //                     $assignee, $gui->startTime,
    //                     $gui->endTime, $tester,
    //                     $argsObj->search_notes_string, null);
    //
    //$gui->suiteList = $re->getSuiteList();  // test executions results
    //// Filter test cases on selected platforms
    //foreach ($gui->suiteList as $suiteid => $tcases)
    //{
    //    $filtered = array();
    //    foreach ($tcases as $index => $tcase) {
    //        if ($tcase['platform_id'] == 0 ||
    //            $argsObj->platformsSelected[0] == ALL_PLATFORMS ||
    //            array_search($tcase['platform_id'], $argsObj->platformsSelected) !== false) {
    //            array_push($filtered, $tcase);
    //        }
    //    }
    //    unset($gui->suiteList[$suiteid]);
    //    $gui->suiteList[$suiteid] = $filtered;
    //}
    //$gui->flatArray = $re->getFlatArray();
    //$gui->mapOfSuiteSummary =  $re->getAggregateMap();
    //
    // Prepare User Feedback
    $gui->totals = new stdClass();
    $gui->totals->items = 0;
    $gui->totals->labels = array();
    foreach ($gui->totals->items as $key => $value) {
        $l18n = $key == 'total' ? 'th_total_cases' : $gui->resultsCfg['status_label'][$key];
        $gui->totals->labels[$key] = lang_get($l18n);
    }
    $gui->keywords = new stdClass();
    $gui->keywords->items[0] = $gui->str_option_any;
    // Sorry MAGIC 0
    if (!is_null($tplan_keywords_map = $tplan_mgr->get_keywords_map($gui->tplan_id))) {
        $gui->keywords->items += $tplan_keywords_map;
    }
    $gui->keywords->qty = count($gui->keywords->items);
    $gui->keywordSelected = $gui->keywords->items[$argsObj->keywordSelected];
    $gui->builds_html = $tplan_mgr->get_builds_for_html_options($gui->tplan_id);
    $gui->users = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, array(TL_USER_ANYBODY => $gui->str_option_any));
    $gui->ownerSelected = $gui->users[$argsObj->ownerSelected];
    $gui->executorSelected = $gui->users[$argsObj->executorSelected];
    $gui->buildsSelected = $argsObj->buildsSelected;
    $gui->platformsSelected = $argsObj->platformsSelected;
    $gui->display = $argsObj->display;
    // init display rows attribute and some status localized labels
    $gui->displayResults = array();
    $gui->lastStatus = array();
    foreach ($reports_cfg->exec_status as $verbose => $label) {
        $gui->displayResults[$gui->resultsCfg['status_code'][$verbose]] = false;
    }
    foreach ($gui->resultsCfg['status_label'] as $status_verbose => $label_key) {
        $gui->statusLabels[$gui->resultsCfg['status_code'][$status_verbose]] = lang_get($label_key);
    }
    $lastStatus_localized = null;
    foreach ($argsObj->lastStatus as $key => $status_code) {
        $verbose = $gui->resultsCfg['code_status'][$status_code];
        $gui->displayResults[$status_code] = true;
        $lastStatus_localized[] = lang_get($gui->resultsCfg['status_label'][$verbose]);
    }
    $gui->lastStatus = $lastStatus_localized;
    return $gui;
}
Exemple #14
0
*
* @internal revisions
* @since 1.9.11
*/
require '../../config.inc.php';
require_once '../../third_party/codeplex/PHPExcel.php';
// Must be included BEFORE common.php
require_once 'common.php';
require_once 'displayMgr.php';
require_once 'exttable.class.php';
$timerOn = microtime(true);
// will be used to compute elapsed time
$templateCfg = templateConfiguration();
$smarty = new TLSmarty();
$args = init_args($db);
$metricsMgr = new tlTestPlanMetrics($db);
$tplan_mgr =& $metricsMgr;
// displayMemUsage('START' . __FILE__);
list($gui, $tproject_info, $labels, $cfg) = initializeGui($db, $args, $smarty->getImages(), $tplan_mgr);
$tprojectOpt = $_SESSION['testprojectOptions'];
$testCaseCfg = config_get('testcase_cfg');
$testCasePrefix = $tproject_info['prefix'] . $testCaseCfg->glue_character;
unset($testCaseCfg);
$mailCfg = buildMailCfg($gui);
//displayMemUsage('Before getExecStatusMatrix()');
// We have faced a performance block due to an environment with
// 700 Builds and 1300 Test Cases on Test Plan
// This created a block on NOT RUN QUERY, but anyway will produce an enormous and
// unmanageable matrix on screen
//
// New way to process:
require_once 'users.inc.php';
require_once 'exttable.class.php';
require_once 'exec.inc.php';
// used for bug string lookup
// IMPORTANT NOTICE/WARNING about XLS generation
// Seams that \n are not liked
// http://stackoverflow.com/questions/5960242/how-to-make-new-lines-in-a-cell-using-phpexcel
//
$templateCfg = templateConfiguration();
$resultsCfg = config_get('results');
$statusCode = $resultsCfg['status_code'];
$args = init_args($db, $statusCode);
$tplan_mgr = new testplan($db);
$tproject_mgr = new testproject($db);
$tcase_mgr = new testcase($db);
$metricsMgr = new tlTestPlanMetrics($db);
$gui = initializeGui($statusCode, $args, $tplan_mgr);
$tplan_info = $tplan_mgr->get_by_id($args->tplan_id);
$tproject_info = $tproject_mgr->get_by_id($args->tproject_id);
// get issue tracker config and object to manage TestLink - BTS integration
$its = null;
$tproject_mgr = new testproject($db);
$info = $tproject_mgr->get_by_id($args->tproject_id);
$gui->bugInterfaceOn = $info['issue_tracker_enabled'];
if ($info['issue_tracker_enabled']) {
    $it_mgr = new tlIssueTracker($db);
    $its = $it_mgr->getInterfaceObject($args->tproject_id);
    unset($it_mgr);
}
$labels = init_labels(array('deleted_user' => null, 'design' => null, 'execution' => null, 'execution_history' => null, 'nobody' => null, 'info_only_with_tester_assignment' => null, 'th_bugs_not_linked' => null, 'info_notrun_tc_report' => null));
$gui->tplan_name = $tplan_info['name'];