当前位置: 首页>>代码示例>>PHP>>正文


PHP testplan::count_testcases方法代码示例

本文整理汇总了PHP中testplan::count_testcases方法的典型用法代码示例。如果您正苦于以下问题:PHP testplan::count_testcases方法的具体用法?PHP testplan::count_testcases怎么用?PHP testplan::count_testcases使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在testplan的用法示例。


在下文中一共展示了testplan::count_testcases方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: templateConfiguration

testlinkInitPage($db, false, false, "checkRights");
$templateCfg = templateConfiguration();
$args = init_args();
$gui = initializeGui($db, $args);
if ($args->tproject_id) {
    $tproject_mgr = new testproject($db);
    $gui->tplans = $args->user->getAccessibleTestPlans($db, $args->tproject_id, null, array('output' => 'mapfull', 'active' => null));
    $gui->drawPlatformQtyColumn = false;
    if (!is_null($gui->tplans) && count($gui->tplans) > 0) {
        // do this test project has platform definitions ?
        $tplan_mgr = new testplan($db);
        $tplan_mgr->platform_mgr->setTestProjectID($args->tproject_id);
        $dummy = $tplan_mgr->platform_mgr->testProjectCount();
        $gui->drawPlatformQtyColumn = $dummy[$args->tproject_id]['platform_qty'] > 0;
        $tplanSet = array_keys($gui->tplans);
        $dummy = $tplan_mgr->count_testcases($tplanSet, null, array('output' => 'groupByTestPlan'));
        $buildQty = $tplan_mgr->get_builds($tplanSet, null, null, array('getCount' => true));
        foreach ($tplanSet as $idk) {
            $gui->tplans[$idk]['tcase_qty'] = isset($dummy[$idk]['qty']) ? intval($dummy[$idk]['qty']) : 0;
            $gui->tplans[$idk]['build_qty'] = isset($buildQty[$idk]['build_qty']) ? intval($buildQty[$idk]['build_qty']) : 0;
            if ($gui->drawPlatformQtyColumn) {
                $plat = $tplan_mgr->getPlatforms($idk);
                $gui->tplans[$idk]['platform_qty'] = is_null($plat) ? 0 : count($plat);
            }
        }
        unset($tplan_mgr);
    }
    unset($tproject_mgr);
}
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
开发者ID:mokal,项目名称:DCN_TestLink,代码行数:31,代码来源:planView.php

示例2: init_args

function init_args(&$dbHandler)
{
    $argsObj = new stdClass();
    $argsObj->doIt = false;
    $argsObj->showPlatforms = false;
    $argsObj->tproject_id = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0;
    $argsObj->tproject_name = isset($_SESSION['testprojectName']) ? $_SESSION['testprojectName'] : '';
    $argsObj->tplan_name = '';
    $argsObj->tplan_id = isset($_REQUEST['tplan_id']) ? $_REQUEST['tplan_id'] : 0;
    if ($argsObj->tplan_id == 0) {
        $argsObj->tplan_id = isset($_SESSION['testplanID']) ? $_SESSION['testplanID'] : 0;
    }
    if ($argsObj->tplan_id > 0) {
        $tplan_mgr = new testplan($dbHandler);
        $tplan_info = $tplan_mgr->get_by_id($argsObj->tplan_id);
        $argsObj->tplan_name = $tplan_info['name'];
        $argsObj->doIt = $tplan_mgr->count_testcases($argsObj->tplan_id) > 0;
        $argsObj->showPlatforms = $tplan_mgr->hasLinkedPlatforms($argsObj->tplan_id);
        unset($tplan_mgr);
    }
    return $argsObj;
}
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:22,代码来源:testCasesWithCF.php

示例3: getMetrics

/**
 *  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) {
//.........这里部分代码省略.........
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:101,代码来源:metricsDashboard.php

示例4: init_args

function init_args(&$dbHandler, &$treeMgr)
{
    $iParams = array("format" => array(tlInputParameter::INT_N), "tproject_id" => array(tlInputParameter::INT_N), "tplan_id" => array(tlInputParameter::INT_N), "type" => array(tlInputParameter::STRING_N, 0, 1));
    $argsObj = new stdClass();
    R_PARAMS($iParams, $argsObj);
    $argsObj->doIt = false;
    $argsObj->showPlatforms = false;
    $argsObj->tproject_name = '';
    if ($argsObj->tproject_id > 0) {
        $dummy = $treeMgr->get_node_hierarchy_info($argsObj->tproject_id);
        $argsObj->tproject_name = $dummy['name'];
    }
    $argsObj->tplan_name = '';
    if ($argsObj->tplan_id > 0) {
        $tplan_mgr = new testplan($dbHandler);
        $tplan_info = $tplan_mgr->get_by_id($argsObj->tplan_id);
        $argsObj->tplan_name = $tplan_info['name'];
        $argsObj->doIt = $tplan_mgr->count_testcases($argsObj->tplan_id) > 0;
        $argsObj->showPlatforms = $tplan_mgr->hasLinkedPlatforms($argsObj->tplan_id);
        $getOpt = array('outputFormat' => 'map');
        $argsObj->platforms = $tplan_mgr->getPlatforms($argsObj->tplan_id, $getOpt);
        unset($tplan_mgr);
    }
    return $argsObj;
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:25,代码来源:testCasesWithCF.php

示例5: dBug

echo "</pre>";
echo "<pre>            get_by_name({$tplan_name})";
echo "</pre>";
$tplan_info = $tplan_mgr->get_by_name($tplan_name);
new dBug($tplan_info);
echo "<pre> testplan - get_builds(\$tplan_id,\$active=null,\$open=null)";
echo "</pre>";
echo "<pre>            get_builds({$tplan_id})";
echo "</pre>";
$all_builds = $tplan_mgr->get_builds($tplan_id);
new dBug($all_builds);
echo "<pre> testplan - count_testcases(\$tplan_id)";
echo "</pre>";
echo "<pre>            count_testcases({$tplan_id})";
echo "</pre>";
$count_testcases = $tplan_mgr->count_testcases($tplan_id);
new dBug("Number of testcase linked to test plan=" . $count_testcases);
// echo "<pre> testplan - get_linked_tcversions(\$tplan_id,\$tcase_id=null,\$keyword_id=0,\$executed=null,
//                                              \$assigned_to=null,\$exec_status=null,\$build_id=0,
//                                              \$cf_hash = null)";echo "</pre>";
//
echo "<pre> testplan - get_linked_tcversions(\$id,\$filters=null,\$options=null)";
echo "</pre>";
echo "<pre>            get_linked_tcversions({$tplan_id})";
echo "</pre>";
$linked_tcversions = $tplan_mgr->get_linked_tcversions($tplan_id);
new dBug($linked_tcversions);
// -------------------------------------------------------------------------------------------
echo "<hr><h2> Build Manager Class </h2>";
echo "<pre> build manager - constructor - build_mgr(&\$db)";
echo "</pre>";
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:31,代码来源:testplan.class.test.php

示例6: getMetrics

/**
 * 
 *	@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['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
    foreach ($test_plans as $key => $value) {
        $tplan_id = $value['id'];
        $linked_tcversions[$tplan_id] = null;
        $platformSet = $tplan_mgr->getPlatforms($tplan_id);
        if (isset($platformSet)) {
            $platforms = array_merge($platforms, $platformSet);
        } else {
            $platforms[]['name'] = $labels['not_aplicable'];
        }
        $show_platforms_for_tplan = !is_null($platformSet);
        if (!$show_platforms_for_tplan) {
            // Julian: replaced array(0=>'')
            $platformSet = array(0 => array('id' => 0));
        } else {
            // 20110615 - Julian - if at least 1 test plan of the test project uses platforms
            //                     we need to display platform column on metrics dashboard
            $show_platforms = true;
        }
        # initialize counters
        foreach ($platformSet as $platform_id => $platform_name) {
            $metrics['testplans'][$tplan_id]['platforms'][$platform_name['id']]['tplan_name'] = $value['name'];
            $metrics['testplans'][$tplan_id]['platforms'][$platform_name['id']]['platform_name'] = $platform_name['id'] == 0 ? $labels['not_aplicable'] : $platform_name['name'];
            $metrics['testplans'][$tplan_id]['platforms'][$platform_name['id']]['active'] = 0;
            $metrics['testplans'][$tplan_id]['overall']['active'] = 0;
            $metrics['total']['active'] = 0;
            $metrics['testplans'][$tplan_id]['platforms'][$platform_name['id']]['executed'] = 0;
            $metrics['testplans'][$tplan_id]['overall']['executed'] = 0;
            $metrics['total']['executed'] = 0;
            foreach ($result_cfg['status_label'] as $key => $status) {
                $metrics['testplans'][$tplan_id]['platforms'][$platform_name['id']][$key] = 0;
                $metrics['testplans'][$tplan_id]['overall'][$key] = 0;
                $metrics['total'][$key] = 0;
            }
        }
        if (($linkedItemsQty = $tplan_mgr->count_testcases($tplan_id)) > 0) {
            $executed = null;
            $not_run = null;
            // get executions ON ACTIVE BUILDS
            //
            // IMPORTANTE NOTICE
            // using 'output' => 'mapOfMap' means we will get JUST ONE exec record for test case / platform
            //
            $options = array('output' => 'mapOfMap', 'steps_info' => 0, 'build_active_status' => 'active');
            $filters = null;
            $executed[$tplan_id] = $tplan_mgr->get_linked_tcversions($tplan_id, $filters, $options);
            // Simple test to cope with active/inactive build
            if (is_null($executed[$tplan_id])) {
                // need a simple call to get linked items and set status to NOT RUN on all items.
                $filters = null;
                $options = array('output' => 'mapOfMap', 'steps_info' => 0, 'forced_exec_status' => $result_cfg['status_code']['not_run']);
                $executed[$tplan_id] = $tplan_mgr->get_linked_tcversions($tplan_id, $filters, $options);
            } else {
                // get NOT EXECUTED on ACTIVE BUILDS and EXECUTED on INACTIVE BUILDS
                // EXECUTED on INACTIVE BUILDS are candidate to become NOT EXECUTED on ACTIVE BUILDS
                //
                $options = array('output' => 'mapOfMap', 'steps_info' => 0, 'build_active_status' => 'active', 'forced_exec_status' => $result_cfg['status_code']['not_run']);
                $filters = array('exec_status' => $result_cfg['status_code']['not_run']);
                $not_run[$tplan_id] = $tplan_mgr->get_linked_tcversions($tplan_id, $filters, $options);
            }
            // Time to work on keys
            $notRunKeys = array_keys($not_run[$tplan_id]);
            foreach ($notRunKeys as $tcaseIDkey) {
                // BUGID 4362
                // Mistake was this:
                // isset($executed[$tplan_id][$key2copy])
                // just means we have found at least one execution.
                // But inside the element we have a map indexed by platform id.
                // If we have N platforms, and have exec on M, we have M elements
                // and MISS TO ADD the N-M NOT EXECUTED generating the issue.
                if (!isset($executed[$tplan_id][$tcaseIDkey])) {
                    $executed[$tplan_id][$tcaseIDkey] = array();
                }
                $executed[$tplan_id][$tcaseIDkey] += $not_run[$tplan_id][$tcaseIDkey];
            }
            $linked_tcversions[$tplan_id] = (array) $executed[$tplan_id];
        }
        // test plan has linked items
    }
    // Get count of executed testcases
    foreach ($linked_tcversions as $tplan_id => $tcinfo) {
        if (!is_null($tcinfo)) {
            foreach ($tcinfo as $tcase_id => $tc) {
//.........这里部分代码省略.........
开发者ID:moraesmv,项目名称:testlink-code,代码行数:101,代码来源:metricsDashboard.php


注:本文中的testplan::count_testcases方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。