Ejemplo n.º 1
0
$gui->object_name = '';
$gui->goback_url = !is_null($args->goback_url) ? $args->goback_url : '';
$gui->object_name = $node['name'];
$gui->page_title = sprintf(lang_get('print_testcase'), $node['name']);
$gui->tproject_name = $args->tproject_name;
$gui->tproject_id = $args->tproject_id;
$gui->tcase_id = $args->tcase_id;
$gui->tcversion_id = $args->tcversion_id;
// Struture defined in printDocument.php
$printingOptions = array('toc' => 0, 'body' => 1, 'summary' => 1, 'header' => 0, 'headerNumbering' => 0, 'passfail' => 0, 'author' => 1, 'notes' => 1, 'requirement' => 1, 'keyword' => 1, 'cfields' => 1, 'displayVersion' => 1, 'displayDates' => 1, 'docType' => SINGLE_TESTCASE, 'importance' => 1);
$level = 0;
$tplanID = 0;
$prefix = null;
$text2print = '';
$text2print .= renderHTMLHeader($gui->page_title, $_SESSION['basehref'], SINGLE_TESTCASE);
$text2print .= renderTestCaseForPrinting($db, $node, $printingOptions, $level, $tplanID, $prefix, $args->tproject_id);
echo $text2print;
/*
  function: init_args
  args:
  
  returns: 
*/
function init_args(&$treeMgr)
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args = new stdClass();
    $args->tcase_id = isset($_REQUEST['testcase_id']) ? intval($_REQUEST['testcase_id']) : 0;
    $args->tcversion_id = isset($_REQUEST['tcversion_id']) ? intval($_REQUEST['tcversion_id']) : 0;
    $args->tproject_name = '';
    $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0;
/**
 *
 */
function renderExecutionForPrinting(&$dbHandler, $baseHref, $id, $userObj = null)
{
    static $tprojectMgr;
    static $tcaseMgr;
    static $st;
    $out = '';
    if (!$st) {
        $st = new stdClass();
        $st->tables = tlDBObject::getDBTables(array('executions', 'builds'));
        $tprojectMgr = new testproject($dbHandler);
        $tcaseMgr = new testcase($dbHandler);
    }
    $sql = " SELECT E.id AS execution_id, E.status, E.execution_ts, E.tester_id," . " E.notes, E.build_id, E.tcversion_id,E.tcversion_number,E.testplan_id," . " E.platform_id,E.execution_duration, " . " B.name AS build_name, B.id AS build_id " . " FROM {$st->tables['executions']} E " . " JOIN {$st->tables['builds']} B  ON B.id = E.build_id " . " WHERE E.id = " . intval($id);
    $exec_info = $dbHandler->get_recordset($sql);
    if (!is_null($exec_info)) {
        $exec_info = $exec_info[0];
        $context['exec_id'] = intval($id);
        $context['tplan_id'] = $exec_info['testplan_id'];
        $context['platform_id'] = $exec_info['platform_id'];
        $context['build_id'] = $exec_info['build_id'];
        $context['level'] = '??';
        // ???
        $node = $tprojectMgr->tree_manager->get_node_hierarchy_info($context['tplan_id']);
        $context['prefix'] = $tprojectMgr->getTestCasePrefix($node['parent_id']);
        $context['tproject_id'] = $node['parent_id'];
        unset($tprojectMgr);
        // IMPORTANT DEVELOPMENT NOTICE
        // Remember that on executions table we have following fields
        //
        // testplan_id
        // tcversion_id
        // tcversion_number
        //
        // a. (testplan_id ,tcversion_id) ARE LINK To testplan_tcversions table
        // b. if user creates a new version of a LINKED AND EXECUTED test case
        //    when he/she updates test plan, ONLY tcversion_id is updated,
        //    while tcversion_number HAS ALWAYS the VERSION HUMAN READABLE NUMBER
        //    of executed version.
        //
        // Then if you want to access specification of executed test case version
        // you need to proceed this way
        // 1. with tcversion_id => get test case id
        // 2. using test case id AND tcversion_number you access the data.
        //
        // Why is important to remember this?
        // Because here we need to get data for renderTestCaseForPrinting
        //
        // The Cinematic Orchestra: To build a home Incubus: Wish you were here Mau Mau: La ola
        $node = $tcaseMgr->tree_manager->get_node_hierarchy_info($exec_info['tcversion_id']);
        // get_by_id($id,$version_id = self::ALL_VERSIONS, $filters = null, $options=null)
        $tcase = $tcaseMgr->get_by_id($node['parent_id'], null, array('version_number' => $exec_info['tcversion_number']));
        $renderOptions = array('toc' => 0, 'body' => 1, 'summary' => 1, 'header' => 0, 'headerNumbering' => 0, 'passfail' => 1, 'author' => 1, 'notes' => 1, 'requirement' => 1, 'keyword' => 1, 'cfields' => 1, 'displayVersion' => 1, 'displayDates' => 1, 'docType' => SINGLE_TESTCASE, 'importance' => 1, 'step_exec_notes' => 1, 'step_exec_status' => 1);
        // need to change keys
        $tcase = $tcase[0];
        $tcase['tcversion_id'] = $tcase['id'];
        $tcase['id'] = $node['parent_id'];
        $env = new stdClass();
        $env->base_href = $baseHref;
        $env->reportType = $renderOptions['docType'];
        $indentLevel = 100000;
        $context['user'] = $userObj;
        $out .= renderTestCaseForPrinting($dbHandler, $tcase, $renderOptions, $env, $context, $indentLevel);
        $out .= '<br>' . lang_get('direct_link') . ':' . $env->base_href . 'lnl.php?type=exec&id=' . intval($id) . '<br>';
        $exec_info = null;
    }
    return $out;
}
Ejemplo n.º 3
0
function renderTestSpecTreeForPrinting(&$db, &$node, $item_type, &$options, $tocPrefix, $tcCnt, $level, $user_id, $tplan_id = 0, $tcPrefix = null, $tprojectID = 0, $platform_id = 0)
{
    static $tree_mgr;
    static $map_id_descr;
    static $tplan_mgr;
    $code = null;
    if (!$tree_mgr) {
        $tplan_mgr = new testplan($db);
        $tree_mgr = new tree($db);
        $map_id_descr = $tree_mgr->node_types;
    }
    $verbose_node_type = $map_id_descr[intval($node['node_type_id'])];
    switch ($verbose_node_type) {
        case 'testproject':
            if ($tplan_id != 0) {
                // we are printing a test plan, get it's custom fields
                $cfieldFormatting = array('table_css_style' => 'class="cf"');
                if ($options['cfields']) {
                    $cfields = $tplan_mgr->html_table_of_custom_field_values($tplan_id, 'design', null, $cfieldFormatting);
                    $code .= '<p>' . $cfields . '</p>';
                }
            }
            // platform changes - $code .= renderTOC($options);
            break;
        case 'testsuite':
            $tocPrefix .= (!is_null($tocPrefix) ? "." : '') . $tcCnt;
            $code .= renderTestSuiteNodeForPrinting($db, $node, $options, $tocPrefix, $level, $tplan_id, $tprojectID);
            break;
        case 'testcase':
            $context = new stdClass();
            $context->tproject_id = $tprojectID;
            $context->tplan_id = $tplan_id;
            $context->platform_id = $platform_id;
            $context->tcase_prefix = $tcPrefix;
            $code .= renderTestCaseForPrinting($db, $node, $options, $level, $context);
            break;
    }
    if (isset($node['childNodes']) && $node['childNodes']) {
        $childNodes = $node['childNodes'];
        $tsCnt = 0;
        $children_qty = sizeof($childNodes);
        for ($i = 0; $i < $children_qty; $i++) {
            $current = $childNodes[$i];
            if (is_null($current)) {
                continue;
            }
            if (isset($current['node_type_id']) && $map_id_descr[$current['node_type_id']] == 'testsuite') {
                $tsCnt++;
            }
            // BUGID 3459 - added $platform_id
            $code .= renderTestSpecTreeForPrinting($db, $current, $item_type, $options, $tocPrefix, $tsCnt, $level + 1, $user_id, $tplan_id, $tcPrefix, $tprojectID, $platform_id);
        }
    }
    if ($verbose_node_type == 'testproject') {
        if ($options['toc']) {
            // remove for platforms feature
            // $options['tocCode'] .= '</div><hr />';
            $code = str_replace("{{INSERT_TOC}}", $options['tocCode'], $code);
        }
    }
    return $code;
}
Ejemplo n.º 4
0
$gui->page_title = sprintf(lang_get('print_testcase'), $node['name']);
$gui->tproject_name = $args->tproject_name;
$gui->tproject_id = $args->tproject_id;
$gui->tcase_id = $args->tcase_id;
$gui->tcversion_id = $args->tcversion_id;
// Struture defined in printDocument.php
$printingOptions = array('toc' => 0, 'body' => 1, 'summary' => 1, 'header' => 0, 'headerNumbering' => 0, 'passfail' => 0, 'author' => 1, 'notes' => 1, 'requirement' => 1, 'keyword' => 1, 'cfields' => 1, 'displayVersion' => 1, 'displayDates' => 1, 'docType' => SINGLE_TESTCASE, 'importance' => 1);
$level = 0;
$tplanID = 0;
$prefix = null;
$text2print = '';
$text2print .= renderHTMLHeader($gui->page_title, $_SESSION['basehref'], SINGLE_TESTCASE, array('gui/javascript/testlink_library.js'));
$env = new stdClass();
$env->base_href = $_SESSION['basehref'];
$env->reportType = $printingOptions['docType'];
$text2print .= renderTestCaseForPrinting($db, $node, $printingOptions, $env, array('level' => $level, 'tplan_id' => $tplanID, 'tproject_id' => $args->tproject_id, 'prefix' => $prefix));
echo $text2print;
/*
  function: init_args
  args:
  
  returns: 
*/
function init_args()
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args = new stdClass();
    $args->tcase_id = isset($_REQUEST['testcase_id']) ? intval($_REQUEST['testcase_id']) : 0;
    $args->tcversion_id = isset($_REQUEST['tcversion_id']) ? intval($_REQUEST['tcversion_id']) : 0;
    $args->tproject_id = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0;
    $args->tproject_name = $_SESSION['testprojectName'];