本文整理汇总了PHP中testplan类的典型用法代码示例。如果您正苦于以下问题:PHP testplan类的具体用法?PHP testplan怎么用?PHP testplan使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了testplan类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initializeGui
/**
*
*/
function initializeGui(&$dbHandler, $args)
{
$locale = isset($_SESSION['locale']) ? $_SESSION['locale'] : 'en_GB';
$localesDateFormat = config_get('locales_date_format');
$date_format = $localesDateFormat[$locale];
$gui = new stdClass();
$tplan_mgr = new testplan($dbHandler);
$tproject_mgr = new testproject($dbHandler);
$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->tplan_id = $args->tplan_id;
$gui->tproject_id = $args->tproject_id;
$tplan_info = $tplan_mgr->get_by_id($gui->tplan_id);
unset($tplan_mgr);
$gui->tplan_name = $tplan_info['name'];
$tproject_info = $tproject_mgr->get_by_id($gui->tproject_id);
unset($tproject_mgr);
$gui->tproject_name = $tproject_info['name'];
$gui->users = new stdClass();
$gui->users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, array(TL_USER_ANYBODY => $gui->str_option_any));
$gui->users->qty = count($gui->users->items);
$reports_cfg = config_get('reportsCfg');
$startDate = strftime($date_format, time() - $reports_cfg->start_date_offset);
$gui->selected_start_date = $startDate;
$gui->selected_start_time = $reports_cfg->start_time;
$gui->selected_end_date = strftime($date_format, time());
$gui->selected_end_time = null;
return $gui;
}
示例2: initializeGui
function initializeGui(&$dbHandler, $args)
{
$gui = new stdClass();
$tplan_mgr = new testplan($dbHandler);
$tproject_mgr = new testproject($dbHandler);
$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->tplan_id = $args->tplan_id;
$gui->tproject_id = $args->tproject_id;
$tplan_info = $tplan_mgr->get_by_id($gui->tplan_id);
$gui->tplan_name = $tplan_info['name'];
$tproject_info = $tproject_mgr->get_by_id($gui->tproject_id);
$gui->tproject_name = $tproject_info['name'];
$re = new results($dbHandler, $tplan_mgr, $tproject_info, $tplan_info);
$gui->assigned_users = new stdClass();
$gui->keywords = new stdClass();
$gui->builds = new stdClass();
$gui->testsuites = new stdClass();
// 20090107 - franciscom
// Show only users that are able to execute test cases ?
// What happens if a user that has loose right to execute, but
// before loosing this right has been assigned some tests, or have executed it?
//
// $gui->assigned_users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, ADD_BLANK_OPTION);
// $gui->assigned_users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER,
// array(TL_USER_ANYBODY => $gui->str_option_any,
// TL_USER_NOBODY => $gui->str_option_none) );
//
$gui->assigned_users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, array(TL_USER_ANYBODY => $gui->str_option_any));
$gui->assigned_users->qty = count($gui->assigned_users->items);
// BUGID 2012 - franciscom
$gui->keywords->items[0] = $gui->str_option_any;
if (!is_null($tplan_keywords_map = $tplan_mgr->get_keywords_map($gui->tplan_id))) {
$gui->keywords->items += $tplan_keywords_map;
}
$gui->builds->items = $tplan_mgr->get_builds($gui->tplan_id, testplan::ACTIVE_BUILDS);
$gui->testsuites->items = $re->getTopLevelSuites();
$gui->keywords->qty = count($gui->keywords->items);
$gui->builds->qty = count($gui->builds->items);
$gui->testsuites->qty = count($gui->testsuites->items);
$gui->status_code_label = get_status_for_reports_html_options();
$gui->report_type = $args->format;
$reports_cfg = config_get('reportsCfg');
$startDate = time() - $reports_cfg->start_date_offset;
$gui->selected_start_date = $startDate;
$gui->selected_start_time = $reports_cfg->start_time;
$gui->selected_end_date = null;
$gui->selected_end_time = null;
return $gui;
}
示例3: init_args
function init_args(&$dbHandler, $cfgObj)
{
$args = new stdClass();
$_REQUEST = strings_stripSlashes($_REQUEST);
$tplan_mgr = new testplan($dbHandler);
// Settings we put on session to create some sort of persistent scope,
// because we have had issues when passing this info using GET mode (size limits)
//
// we get info about build_id, platform_id, etc ...
getContextFromGlobalScope($args);
$args->user = $_SESSION['currentUser'];
$args->user_id = $args->user->dbID;
$args->caller = isset($_REQUEST['caller']) ? $_REQUEST['caller'] : 'exec_feature';
$args->reload_caller = false;
$args->tplan_id = intval(isset($_REQUEST['tplan_id']) ? $_REQUEST['tplan_id'] : $_SESSION['testplanID']);
$args->tproject_id = intval(isset($_REQUEST['tproject_id']) ? $_REQUEST['tproject_id'] : $_SESSION['testprojectID']);
if ($args->tproject_id <= 0) {
$tree_mgr = new tree($dbHandler);
$dm = $tree_mgr->get_node_hierarchy_info($args->tplan_id);
$args->tproject_id = $dm['parent_id'];
}
if (is_null($args->build_id) || $args->build_id == 0) {
// Go for the build
// this info can be present in session, then we will try different ways
// ATTENTION:
// give a look to tlTestCaseFilterControl.class.php method init_setting_build()
//
$key = $args->tplan_id . '_stored_setting_build';
$args->build_id = isset($_SESSION[$key]) ? intval($_SESSION[$key]) : null;
if (is_null($args->build_id)) {
$args->build_id = $tplan_mgr->get_max_build_id($args->tplan_id, 1, 1);
}
}
if (is_null($args->platform_id) || $args->platform_id <= 0) {
// Go for the platform (if any exists)
// this info can be present in session, then we will try different ways
// ATTENTION:
// give a look to tlTestCaseFilterControl.class.php method init_setting_platform()
//
$itemSet = $tplan_mgr->getPlatforms($args->tplan_id);
if (!is_null($itemSet)) {
$key = $args->tplan_id . '_stored_setting_platform';
$args->platform_id = isset($_SESSION[$key]) ? intval($_SESSION[$key]) : null;
if (is_null($args->platform_id) || $args->platform_id <= 0) {
$args->platform_id = $itemSet[0]['id'];
}
}
}
return array($args, $tplan_mgr);
}
示例4: init_args
function init_args(&$dbHandler)
{
$_REQUEST = strings_stripSlashes($_REQUEST);
$args = new stdClass();
$args->target_date = null;
$args->start_date = null;
// Important!!!
// name of these variables is generated by smarty (See html_select_date in Smarty Manual)
$date_vars = array('target_date_Year', 'target_date_Month', 'target_date_Day');
$start_date_vars = array('start_date_Year', 'start_date_Month', 'start_date_Day');
$create_date = true;
$create_start_date = true;
foreach ($date_vars as $my) {
${$my} = isset($_REQUEST[$my]) ? $_REQUEST[$my] : null;
$create_date = $create_date && !is_null(${$my}) && trim(${$my}) != '';
}
if ($create_date) {
$args->target_date = $target_date_Year . "-" . $target_date_Month . "-" . $target_date_Day;
}
foreach ($start_date_vars as $my) {
${$my} = isset($_REQUEST[$my]) ? $_REQUEST[$my] : null;
$create_start_date = $create_start_date && !is_null(${$my}) && trim(${$my}) != '';
}
if ($create_start_date) {
$args->start_date = $start_date_Year . "-" . $start_date_Month . "-" . $start_date_Day;
}
$key2loop = array('low_priority_tcases', 'medium_priority_tcases', 'high_priority_tcases');
foreach ($key2loop as $key) {
$args->{$key} = isset($_REQUEST[$key]) ? intval($_REQUEST[$key]) : 0;
}
$args->id = isset($_REQUEST['id']) ? $_REQUEST['id'] : 0;
$args->name = isset($_REQUEST['milestone_name']) ? $_REQUEST['milestone_name'] : null;
$args->doAction = isset($_REQUEST['doAction']) ? $_REQUEST['doAction'] : null;
$args->basehref = $_SESSION['basehref'];
$args->tproject_id = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0;
$args->tproject_name = isset($_SESSION['testprojectName']) ? $_SESSION['testprojectName'] : "";
$args->tplan_name = '';
$args->tplan_id = isset($_REQUEST['tplan_id']) ? $_REQUEST['tplan_id'] : 0;
if ($args->tplan_id == 0) {
$args->tplan_id = isset($_SESSION['testplanID']) ? $_SESSION['testplanID'] : 0;
}
if ($args->tplan_id > 0) {
$tplan_mgr = new testplan($dbHandler);
$info = $tplan_mgr->get_by_id($args->tplan_id);
$args->tplan_name = $info['name'];
}
return $args;
}
示例5: init_args
function init_args(&$dbHandler, $dateFormat)
{
$_REQUEST = strings_stripSlashes($_REQUEST);
$args = new stdClass();
$args->target_date_original = isset($_REQUEST['target_date']) ? $_REQUEST['target_date'] : null;
$args->start_date_original = isset($_REQUEST['start_date']) ? $_REQUEST['start_date'] : null;
// convert target date to iso format to write to db
if (isset($_REQUEST['target_date']) && $_REQUEST['target_date'] != '') {
$date_array = split_localized_date($_REQUEST['target_date'], $dateFormat);
if ($date_array != null) {
// set date in iso format
$args->target_date = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'];
}
}
// convert start date to iso format to write to db
if (isset($_REQUEST['start_date']) && $_REQUEST['start_date'] != '') {
$date_array = split_localized_date($_REQUEST['start_date'], $dateFormat);
if ($date_array != null) {
// set date in iso format
$args->start_date = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'];
}
}
$key2loop = array('low_priority_tcases', 'medium_priority_tcases', 'high_priority_tcases');
foreach ($key2loop as $key) {
$args->{$key} = isset($_REQUEST[$key]) ? intval($_REQUEST[$key]) : 0;
}
$args->id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
$args->name = isset($_REQUEST['milestone_name']) ? $_REQUEST['milestone_name'] : null;
$args->doAction = isset($_REQUEST['doAction']) ? $_REQUEST['doAction'] : null;
$args->basehref = $_SESSION['basehref'];
$args->tproject_id = isset($_SESSION['testprojectID']) ? intval($_SESSION['testprojectID']) : 0;
$args->tproject_name = isset($_SESSION['testprojectName']) ? $_SESSION['testprojectName'] : "";
$args->tplan_name = '';
$args->tplan_id = isset($_REQUEST['tplan_id']) ? intval($_REQUEST['tplan_id']) : 0;
if ($args->tplan_id == 0) {
$args->tplan_id = isset($_SESSION['testplanID']) ? intval($_SESSION['testplanID']) : 0;
}
if ($args->tplan_id > 0) {
$tplan_mgr = new testplan($dbHandler);
$info = $tplan_mgr->get_by_id($args->tplan_id);
$args->tplan_name = $info['name'];
}
return $args;
}
示例6: initializeGui
function initializeGui(&$dbHandler, &$argsObj, &$userObj, &$tprojectMgr)
{
$tcaseCfg = config_get('testcase_cfg');
$guiObj = new stdClass();
$guiObj->can_manage_testplans = $userObj->hasRight($dbHandler, "mgt_testplan_create", $argsObj->tproject_id, $argsObj->tplan_id);
$guiObj->show_details = 0;
$guiObj->user_feedback = '';
$guiObj->tcasePrefix = $tprojectMgr->getTestCasePrefix($argsObj->tproject_id) . $tcaseCfg->glue_character;
$guiObj->tproject_name = $argsObj->tproject_name;
$tplanMgr = new testplan($dbHandler);
$tplan_info = $tplanMgr->get_by_id($argsObj->tplan_id);
$guiObj->tplan_name = $tplan_info['name'];
$guiObj->tplan_id = $argsObj->tplan_id;
$guiObj->tproject_id = $argsObj->tproject_id;
$guiObj->testcases = $tplanMgr->get_linked_and_newest_tcversions($argsObj->tplan_id);
$linked_tcases = $tplanMgr->get_linked_items_id($argsObj->tplan_id);
$guiObj->doIt = count($linked_tcases) > 0;
$guiObj->tplans = array();
$tplans = $userObj->getAccessibleTestPlans($dbHandler, $argsObj->tproject_id);
foreach ($tplans as $key => $value) {
$guiObj->tplans[$value['id']] = $value['name'];
}
return $guiObj;
}
示例7: initializeGui
function initializeGui(&$dbHandler, $args)
{
$gui = new stdClass();
$tplan_mgr = new testplan($dbHandler);
$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->tplan_id = $args->tplan_id;
$gui->tproject_id = $args->tproject_id;
$tplan_info = $tplan_mgr->get_by_id($gui->tplan_id);
$gui->tplan_name = $tplan_info['name'];
unset($tplan_info);
$ni = $tplan_mgr->tree_manager->get_node_hierarchy_info($gui->tproject_id);
$gui->tproject_name = $ni['name'];
unset($ni);
$gui->assigned_users = new stdClass();
$gui->keywords = new stdClass();
$gui->builds = new stdClass();
$gui->platforms = new stdClass();
$gui->testsuites = new stdClass();
// 20090107 - franciscom
// Show only users that are able to execute test cases ?
// What happens if a user that has loose right to execute, but
// before loosing this right has been assigned some tests, or have executed it?
//
// $gui->assigned_users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, ADD_BLANK_OPTION);
// $gui->assigned_users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER,
// array(TL_USER_ANYBODY => $gui->str_option_any,
// TL_USER_NOBODY => $gui->str_option_none) );
//
$gui->assigned_users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, array(TL_USER_ANYBODY => $gui->str_option_any));
$gui->builds->items = $tplan_mgr->get_builds($gui->tplan_id, testplan::ACTIVE_BUILDS);
$gui->platforms->items = $tplan_mgr->getPlatforms($gui->tplan_id);
$gui->testsuites->items = $tplan_mgr->getRootTestSuites($gui->tplan_id, $gui->tproject_id, array('output' => 'plain'));
$gui->keywords->items[0] = $gui->str_option_any;
if (!is_null($tplan_keywords_map = $tplan_mgr->get_keywords_map($gui->tplan_id))) {
$gui->keywords->items += $tplan_keywords_map;
}
$key2loop = array('keywords', 'builds', 'platforms', 'testsuites', 'assigned_users');
foreach ($key2loop as $kx) {
$gui->{$kx}->qty = count($gui->{$kx}->items);
}
$gui->status_code_label = get_status_for_reports_html_options();
$gui->report_type = $args->format;
$reports_cfg = config_get('reportsCfg');
$ldf = config_get('locales_date_format');
$date_format = $ldf[isset($_SESSION['locale']) ? $_SESSION['locale'] : 'en_GB'];
$gui->selected_start_date = strftime($date_format, time() - $reports_cfg->start_date_offset);
$gui->selected_start_time = $reports_cfg->start_time;
$gui->selected_end_date = strftime($date_format, time());
$gui->selected_end_time = null;
return $gui;
}
示例8: init_args
/**
* initialize user input
*
* @param resource dbHandler
* @return array $args array with user input information
*/
function init_args(&$dbHandler)
{
$iParams = array("apikey" => array(tlInputParameter::STRING_N, 0, 64), "tproject_id" => array(tlInputParameter::INT_N), "tplan_id" => array(tlInputParameter::INT_N), "format" => array(tlInputParameter::INT_N));
$args = new stdClass();
$pParams = R_PARAMS($iParams, $args);
if (!is_null($args->apikey)) {
$cerbero = new stdClass();
$cerbero->args = new stdClass();
$cerbero->args->tproject_id = $args->tproject_id;
$cerbero->args->tplan_id = $args->tplan_id;
if (strlen($args->apikey) == 32) {
$cerbero->args->getAccessAttr = true;
$cerbero->method = 'checkRights';
$cerbero->redirect_target = "../../login.php?note=logout";
setUpEnvForRemoteAccess($dbHandler, $args->apikey, $cerbero);
} else {
$args->addOpAccess = false;
$cerbero->method = null;
$cerbero->args->getAccessAttr = false;
setUpEnvForAnonymousAccess($dbHandler, $args->apikey, $cerbero);
}
} else {
testlinkInitPage($dbHandler, false, false, "checkRights");
$args->tproject_id = isset($_SESSION['testprojectID']) ? intval($_SESSION['testprojectID']) : 0;
}
$tproject_mgr = new testproject($dbHandler);
$tplan_mgr = new testplan($dbHandler);
if ($args->tproject_id > 0) {
$args->tproject_info = $tproject_mgr->get_by_id($args->tproject_id);
$args->tproject_name = $args->tproject_info['name'];
$args->tproject_description = $args->tproject_info['notes'];
}
if ($args->tplan_id > 0) {
$args->tplan_info = $tplan_mgr->get_by_id($args->tplan_id);
}
return array($args, $tproject_mgr, $tplan_mgr);
}
示例9: testlinkInitPage
<?php
require_once "../../config.inc.php";
require_once "common.php";
testlinkInitPage($db, false, false, "checkRights");
$templateCfg = templateConfiguration();
$args = init_args();
$gui = new stdClass();
$tplan_mgr = new testplan($db);
$build_mgr = new build_mgr($db);
$needsave = isset($_GET['save']) ? $_GET['save'] : 0;
$tplanid = isset($_GET['tplanid']) ? $_GET['tplanid'] : 1;
$buildid = isset($_GET['buildid']) ? $_GET['buildid'] : 1;
$deviceid = isset($_GET['deviceid']) ? $_GET['deviceid'] : 1;
$topotype = isset($_GET['topotype']) ? $_GET['topotype'] : 999;
$suite = isset($_GET['suite']) ? $_GET['suite'] : 1;
$gui->saveresult = 2;
if ($needsave == 1) {
$result = isset($_POST['result']) ? $_POST['result'] : 'none';
$result_summary = isset($_POST['result_summary']) ? $_POST['result_summary'] : '';
$reviewer = isset($_POST['reviewer']) ? $_POST['reviewer'] : '';
$review_summary = isset($_POST['review_summary']) ? $_POST['review_summary'] : '';
$result_report = isset($_POST['result_report']) ? $_POST['result_report'] : '';
$gui->saveresult = $tplan_mgr->setTestResult($tplanid, $deviceid, $buildid, $topotype, $suite, $result, $result_summary, $reviewer, $review_summary, $result_report);
}
$gui->reviewers = $tplan_mgr->get_review_users();
$dcnresult = $tplan_mgr->getTestResult($tplanid, $deviceid, $buildid, $topotype, $suite);
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->assign('tplanid', $tplanid);
$smarty->assign('buildid', $buildid);
示例10: testlinkInitPage
* noew use method from test plan class.
*
* 20090209 - franciscom - BUGID 2080
* 20080928 - franciscom - removed useless requires
* 20050807 - fm - refactoring: changes in getTestSuiteReport() call
* 20050905 - fm - reduce global coupling
* 20070101 - KL - upgraded to 1.7
* 20080626 - mht - added milestomes, priority report, refactorization
*
* ----------------------------------------------------------------------------------- */
require '../../config.inc.php';
require_once 'common.php';
require_once 'results.class.php';
require_once 'displayMgr.php';
testlinkInitPage($db, true, false, "checkRights");
$tplan_mgr = new testplan($db);
$tproject_mgr = new testproject($db);
$templateCfg = templateConfiguration();
$args = init_args();
$tplan_info = $tplan_mgr->get_by_id($args->tplan_id);
$tproject_info = $tproject_mgr->get_by_id($args->tproject_id);
$arrDataSuite = array();
$gui = new stdClass();
$gui->title = lang_get('title_gen_test_rep');
$gui->do_report = array();
$gui->showPlatforms = true;
$gui->columnsDefinition = new stdClass();
$gui->columnsDefinition->keywords = null;
$gui->columnsDefinition->testers = null;
$gui->columnsDefinition->platform = null;
$gui->statistics = new stdClass();
示例11: testlinkInitPage
<?php
//@TODO this file seems not to be in use
include "../../third_party/charts/charts.php";
require_once '../functions/results.class.php';
require_once '../functions/testplan.class.php';
testlinkInitPage($db);
$tplan_mgr = new testplan($db);
$tproject_mgr = new testproject($db);
$tplan_id = $_REQUEST['tplan_id'];
$tproject_id = $_SESSION['testprojectID'];
$tplan_info = $tplan_mgr->get_by_id($tplan_id);
$tproject_info = $tproject_mgr->get_by_id($tproject_id);
$re = new results($db, $tplan_mgr, $tproject_info, $tplan_info, ALL_TEST_SUITES, ALL_BUILDS);
/**
* KEYWORDS REPORT
*/
$arrDataKeys = $re->getAggregateKeywordResults();
$i = 0;
$arrDataKeys2 = null;
if ($arrDataKeys != null) {
while ($keywordId = key($arrDataKeys)) {
$arr = $arrDataKeys[$keywordId];
$arrDataKeys2[$i] = $arr;
$i++;
next($arrDataKeys);
}
}
$namesOfKeywordsArray = array();
$namesOfKeywordsArray[0] = "";
$passArray = array();
示例12: testproject
// 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);
}
$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'];
示例13: getMetrics
function getMetrics(&$db, $args)
{
$user_id = $args->currentUserID;
$tproject_id = $args->tproject_id;
$linked_tcversions = array();
$metrics = array();
$tplan_mgr = new testplan($db);
$show_platforms = false;
// BUGID 1215
// get all tesplans accessibles for user, for $tproject_id
if ($args->show_only_active) {
$options = array('active' => ACTIVE);
} else {
$options = array('active' => TP_ALL_STATUS);
}
$test_plans = $_SESSION['currentUser']->getAccessibleTestPlans($db, $tproject_id, null, $options);
// Get count of testcases linked to every testplan
foreach ($test_plans as $key => $value) {
$tplan_id = $value['id'];
$filters = null;
$options = array('output' => 'mapOfMap', 'steps_info' => 0);
$linked_tcversions[$tplan_id] = $tplan_mgr->get_linked_tcversions($tplan_id, $filters, $options);
$platformSet = $tplan_mgr->getPlatforms($tplan_id);
if (is_null($platformSet)) {
//Julian: replaced array(0=>'')
$platformSet = array(0 => array('id' => 0));
} else {
$show_platforms = true;
}
foreach ($platformSet as $platform_id => $platform_name) {
$metrics[$tplan_id][$platform_name['id']]['tplan_name'] = $value['name'];
$metrics[$tplan_id][$platform_name['id']]['platform_name'] = $platform_name['id'] == 0 ? lang_get('not_aplicable') : $platform_name['name'];
$metrics[$tplan_id][$platform_name['id']]['executed'] = 0;
$metrics[$tplan_id][$platform_name['id']]['active'] = 0;
$metrics[$tplan_id][$platform_name['id']]['total'] = 0;
$metrics[$tplan_id][$platform_name['id']]['executed_vs_active'] = -1;
$metrics[$tplan_id][$platform_name['id']]['executed_vs_total'] = -1;
$metrics[$tplan_id][$platform_name['id']]['active_vs_total'] = -1;
}
}
// Get count of executed testcases
foreach ($linked_tcversions as $tplan_id => $tcinfo) {
if (!is_null($tcinfo)) {
foreach ($tcinfo as $tcase_id => $tc) {
foreach ($tc as $platform_id => $value) {
if ($value['exec_id'] > 0) {
$metrics[$tplan_id][$platform_id]['executed']++;
}
if ($value['active']) {
$metrics[$tplan_id][$platform_id]['active']++;
}
$metrics[$tplan_id][$platform_id]['total']++;
}
}
}
}
// Calculate percentages
$round_precision = config_get('dashboard_precision');
foreach ($metrics as $tplan_id => $platform_metrics) {
$platforms = array_keys($platform_metrics);
foreach ($platforms as $platform_id) {
$planMetrics =& $metrics[$tplan_id][$platform_id];
if ($planMetrics['total'] > 0) {
if ($planMetrics['active'] > 0) {
$planMetrics['executed_vs_active'] = $planMetrics['executed'] / $planMetrics['active'];
$planMetrics['executed_vs_active'] = round($planMetrics['executed_vs_active'] * 100, $round_precision);
}
$planMetrics['executed_vs_total'] = $planMetrics['executed'] / $planMetrics['total'];
$planMetrics['executed_vs_total'] = round($planMetrics['executed_vs_total'] * 100, $round_precision);
$planMetrics['active_vs_total'] = $planMetrics['active'] / $planMetrics['total'];
$planMetrics['active_vs_total'] = round($planMetrics['active_vs_total'] * 100, $round_precision);
}
}
}
return array($metrics, $show_platforms);
}
示例14: testsuite
case 'testsuite':
$tsuite = new testsuite($db);
$tInfo = $tsuite->get_by_id($args->itemID);
$tInfo['childNodes'] = isset($subtree['childNodes']) ? $subtree['childNodes'] : null;
$treeForPlatform[0]['childNodes'] = array($tInfo);
$doc_info->title = htmlspecialchars(isset($tInfo['name']) ? $args->tproject_name . $tlCfg->gui_title_separator_2 . $tInfo['name'] : $args->tproject_name);
break;
}
break;
case DOC_TEST_PLAN_DESIGN:
$printingOptions['metrics'] = true;
// FORCE
// FORCE
case DOC_TEST_PLAN_EXECUTION:
case DOC_TEST_PLAN_EXECUTION_ON_BUILD:
$tplan_mgr = new testplan($db);
$tplan_info = $tplan_mgr->get_by_id($args->tplan_id);
if ($args->build_id > 0) {
$xx = $tplan_mgr->get_builds($args->tplan_id, null, null, array('buildID' => $args->build_id));
$doc_info->build_name = htmlspecialchars($xx[$args->build_id]['name']);
}
$doc_info->testplan_name = htmlspecialchars($tplan_info['name']);
$doc_info->testplan_scope = $tplan_info['notes'];
$doc_info->title = $doc_info->testplan_name;
// Changed to get ALL platform attributes.
$getOpt = array('outputFormat' => 'mapAccessByID', 'addIfNull' => true);
$platforms = $tplan_mgr->getPlatforms($args->tplan_id, $getOpt);
$platformIDSet = array_keys($platforms);
$printingOptions['priority'] = $doc_info->test_priority_enabled;
$items2use = (object) array('estimatedExecTime' => null, 'realExecTime' => null);
$treeForPlatform = array();
示例15: tLog
//$reports_mgr->get_count_builds();
tLog('Active Builds count = ' . $build_count);
if ($build_count == 0) {
// Test plan without builds can have execution data
$gui->do_report['status_ok'] = 0;
$gui->do_report['msg'] = lang_get('report_tplan_has_no_build');
}
// -----------------------------------------------------------------------------
// get navigation data
$gui->menuItems = array();
if ($gui->do_report['status_ok']) {
// create a list or reports
$context = new stdClass();
$context->tproject_id = $args->tproject_id;
$context->tplan_id = $args->tplan_id;
$tplan_mgr = new testplan($db);
$dmy = $tplan_mgr->get_by_id($context->tplan_id);
$gui->buildInfoSet = $tplan_mgr->get_builds($gui->tplan_id);
$report_plans = $tplan_mgr->report_get_plans($args->tproject_id);
$report_suites = $tplan_mgr->report_get_suites($args->tproject_id);
$report_builds = $tplan_mgr->report_get_builds();
$report_build_total = count($report_builds);
$report_devices = $tplan_mgr->report_get_devices($args->tproject_id);
$report_device_total = count($report_devices);
unset($tplan_mgr);
$context->apikey = $dmy['api_key'];
// $context->apikey = $_SESSION['currentUser']->userApiKey;
$context->imgSet = $smarty->getImages();
$gui->menuItems = $reports_mgr->get_list_reports($context, $gui->btsEnabled, $args->optReqs, $tlCfg->reports_formats[$args->format]);
}
$smarty->assign('gui', $gui);