• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP testcase类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: addIssue

function addIssue($dbHandler, $argsObj, $itsObj)
{
    $opOK = false;
    $msg = '';
    $resultsCfg = config_get('results');
    $tcaseMgr = new testcase($dbHandler);
    $dummy = $tcaseMgr->tree_manager->get_node_hierarchy_info($argsObj->tcversion_id);
    $auditSign = $tcaseMgr->getAuditSignature((object) array('id' => $dummy['parent_id']));
    $exec = current($tcaseMgr->getExecution($argsObj->exec_id, $argsObj->tcversion_id));
    $dummy = $exec['status'];
    if (isset($resultsCfg['code_status'][$exec['status']])) {
        $dummy = $resultsCfg['code_status'][$exec['status']];
    }
    $exec['statusVerbose'] = sprintf(lang_get('issue_exec_result'), $dummy);
    unset($tcaseMgr);
    $signature = sprintf(lang_get('issue_generated_description'), $argsObj->exec_id, $exec['tester_login'], $exec['testplan_name']);
    if ($exec['platform_id'] > 0) {
        $signature .= sprintf(lang_get('issue_platform'), $exec['platform_name']);
    }
    $signature .= sprintf(lang_get('issue_build') . lang_get('execution_ts_iso'), $exec['build_name'], $exec['execution_ts']) . "\n" . $exec['statusVerbose'] . "\n\n" . $exec['execution_notes'];
    $rs = $itsObj->addIssue($auditSign . ' - ' . sprintf(lang_get('execution_ts_iso'), $exec['execution_ts']), $signature);
    if ($rs['status_ok']) {
        $msg = $rs['msg'];
        $opOK = true;
        if (write_execution_bug($dbHandler, $argsObj->exec_id, $rs['id'])) {
            logAuditEvent(TLS("audit_executionbug_added", $rs['id']), "CREATE", $argsObj->exec_id, "executions");
        }
    } else {
        $msg = $rs['msg'];
    }
    return array($opOK, $msg);
}
开发者ID:mokal,项目名称:DCN_TestLink,代码行数:32,代码来源:bugAdd.php


示例2: initializeGUI

function initializeGUI(&$dbHandler, $argsObj)
{
    $gui = new stdClass();
    $gui->tc_id = $argsObj->tcase_id;
    $gui->compare_selected_versions = $argsObj->compare_selected_versions;
    $gui->context = $argsObj->context;
    $tcaseMgr = new testcase($dbHandler);
    $gui->tc_versions = $tcaseMgr->get_by_id($argsObj->tcase_id);
    $gui->tcaseName = $gui->tc_versions[0]['name'];
    unset($tcaseMgr);
    $lblkeys = array('num_changes' => null, 'no_changes' => null, 'version_short' => null, 'diff_subtitle_tc' => null);
    $gui->labels = init_labels($lblkeys);
    $gui->version_short = $gui->labels['version_short'];
    $gui->subtitle = sprintf($gui->labels['diff_subtitle_tc'], $argsObj->version_left, $argsObj->version_left, $argsObj->version_right, $argsObj->version_right, $gui->tcaseName);
    $gui->leftID = "v{$argsObj->version_left}";
    $gui->rightID = "v{$argsObj->version_right}";
    return $gui;
}
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:18,代码来源:tcCompareVersions.php


示例3: initGuiBean

 /**
  * 
  *
  */
 function initGuiBean(&$argsObj)
 {
     $obj = new stdClass();
     $obj->action = '';
     $obj->attachments = null;
     $obj->cleanUpWebEditor = false;
     $obj->containerID = '';
     $obj->direct_link = null;
     $obj->execution_types = $this->execution_types;
     $obj->grants = $this->grants;
     $obj->has_been_executed = false;
     $obj->initWebEditorFromTemplate = false;
     $obj->main_descr = '';
     $obj->name = '';
     $obj->path_info = null;
     $obj->refreshTree = 0;
     $obj->sqlResult = '';
     $obj->step_id = -1;
     $obj->step_set = '';
     $obj->steps = '';
     $dummy = testcase::getLayout();
     $obj->tableColspan = $dummy->tableToDisplayTestCaseSteps->colspan;
     $obj->tcase_id = property_exists($argsObj, 'tcase_id') ? $argsObj->tcase_id : -1;
     $obj->viewerArgs = null;
     $p2check = 'goback_url';
     $obj->{$p2check} = '';
     if (property_exists($argsObj, $p2check)) {
         $obj->{$p2check} = !is_null($argsObj->{$p2check}) ? $argsObj->{$p2check} : '';
     }
     $p2check = 'show_mode';
     if (property_exists($argsObj, $p2check)) {
         $obj->{$p2check} = !is_null($argsObj->{$p2check}) ? $argsObj->{$p2check} : 'show';
     }
     // need to check where is used
     $obj->loadOnCancelURL = "archiveData.php?edit=testcase&show_mode={$obj->show_mode}&id=%s&version_id=%s";
     return $obj;
 }
开发者ID:mweyamutsvene,项目名称:testlink,代码行数:41,代码来源:testcaseCommands.class.php


示例4: testlinkInitPage

require_once "../../config.inc.php";
require_once "common.php";
require_once "opt_transfer.php";
testlinkInitPage($db, false, false, "checkRights");
$templateCfg = templateConfiguration();
$opt_cfg = opt_transf_empty_cfg();
$opt_cfg->js_ot_name = 'ot';
$args = init_args($opt_cfg);
if ($args->edit == 'testproject') {
    // We can NOT assign/remove keywords on a whole test project
    show_instructions('keywordsAssign');
    exit;
}
$smarty = new TLSmarty();
$tproject_mgr = new testproject($db);
$tcase_mgr = new testcase($db);
$result = null;
$keyword_assignment_subtitle = null;
$can_do = 0;
$itemID = null;
$opt_cfg->global_lbl = '';
$opt_cfg->additional_global_lbl = null;
$opt_cfg->from->lbl = lang_get('available_kword');
$opt_cfg->to->lbl = lang_get('assigned_kword');
$opt_cfg->from->map = $tproject_mgr->get_keywords_map($args->testproject_id);
$opt_cfg->to->map = $tcase_mgr->get_keywords_map($args->id, " ORDER BY keyword ASC ");
if ($args->edit == 'testsuite') {
    // We are going to walk all test suites contained
    // in the selected container, and assign/remove keywords on each test case.
    $tsuite_mgr = new testsuite($db);
    $testsuite = $tsuite_mgr->get_by_id($args->id);
开发者ID:tamtrong,项目名称:testlink,代码行数:31,代码来源:keywordsAssign.php


示例5: testlinkInitPage

 * @filesource	tcAssignedToUser.php
 * @package 	  TestLink
 * @copyright 	2005,2012 TestLink community 
 * @author 		  Francisco Mancardi - [email protected]
 * @link 		    http://www.teamst.org/index.php
 *
 * @internal revisions
 * @since 2.0
 */
require_once "../../config.inc.php";
require_once "common.php";
testlinkInitPage($db);
$templateCfg = templateConfiguration();
$results_config = config_get('results');
$args = init_args($db);
$tcase_mgr = new testcase($db);
$gui = new stdClass();
$gui->show_build_selector = $args->build_id == 0;
$gui->glueChar = config_get('testcase_cfg')->glue_character;
$gui->tproject_id = $args->tproject_id;
$gui->tproject_name = $args->tproject_name;
$gui->warning_msg = '';
$gui->tableSet = null;
$history_img = TL_THEME_IMG_DIR . "history_small.png";
$exec_img = TL_THEME_IMG_DIR . "exec_icon.png";
$edit_img = TL_THEME_IMG_DIR . "edit_icon.png";
$l18n = init_labels(array('tcversion_indicator' => null, 'goto_testspec' => null, 'version' => null, 'testplan' => null, 'assigned_tc_overview' => null, 'testcases_created_per_user' => null, 'design' => null, 'execution' => null, 'execution_history' => null));
$gui->pageTitle = sprintf($l18n['testcases_created_per_user'], $gui->tproject_name);
$priority = array(LOW => lang_get('low_priority'), MEDIUM => lang_get('medium_priority'), HIGH => lang_get('high_priority'));
$map_status_code = $results_config['status_code'];
$map_code_status = $results_config['code_status'];
开发者ID:moraesmv,项目名称:testlink-code,代码行数:31,代码来源:tcCreatedPerUser.php


示例6: getLastExecutions

function getLastExecutions(&$db, $tcaseSet, $tplanId)
{
    $execMap = array();
    if (sizeof($tcaseSet)) {
        $tcase_mgr = new testcase($db);
        $items = array_keys($tcaseSet);
        $path_info = $tcase_mgr->tree_manager->get_full_path_verbose($items);
        $options = array('getNoExecutions' => 1, 'groupByBuild' => 0);
        foreach ($tcaseSet as $tcaseId => $tcInfo) {
            $execMap[$tcaseId] = $tcase_mgr->get_last_execution($tcaseId, $tcInfo['tcversion_id'], $tplanId, testcase::ANY_BUILD, testcase::ANY_PLATFORM, $options);
            unset($path_info[$tcaseId][0]);
            // remove test project name
            $path_info[$tcaseId][] = '';
            $execMap[$tcaseId][$tcInfo['tcversion_id']]['tcase_path'] = implode(' / ', $path_info[$tcaseId]);
        }
        unset($tcase_mgr);
    }
    return $execMap;
}
开发者ID:mokal,项目名称:DCN_TestLink,代码行数:19,代码来源:requirements.inc.php


示例7: downloadContentsToFile

        if ($exporting_just_one_tc) {
            $optExport['ROOTELEM'] = "<testcases>{{XMLCODE}}</testcases>";
            $content = $tcase_mgr->{$pfn}($args->tcase_id, $args->tcversion_id, $args->tproject_id, null, $optExport);
        } else {
            $content = TL_XMLEXPORT_HEADER;
            $content .= $tsuite_mgr->{$pfn}($args->container_id, $args->tproject_id, $optExport);
        }
        downloadContentsToFile($content, $gui->export_filename);
        exit;
    }
}
if ($args->useRecursion) {
    // we are working on a testsuite
    $obj_mgr = new testsuite($db);
} else {
    $obj_mgr = new testcase($db);
}
$gui->object_name = $node['name'];
$gui->exportTypes = $obj_mgr->get_export_file_types();
$gui->tproject_name = $args->tproject_name;
$gui->tproject_id = $args->tproject_id;
$gui->tcID = $args->tcase_id;
$gui->useRecursion = $args->useRecursion ? 1 : 0;
$gui->tcVersionID = $args->tcversion_id;
$gui->containerID = $args->container_id;
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
/*
  function: init_args
  args:
开发者ID:moraesmv,项目名称:testlink-code,代码行数:31,代码来源:tcExport.php


示例8: date_create_from_format

     $date_from = date_create_from_format('Y-n-j', $args->creation_date_from);
     $date_to = date_create_from_format('Y-n-j', $args->creation_date_to);
 }
 if (!is_null($args->creation_date_from)) {
     $db_date = $db->db->DBdate($args->creation_date_from);
     $filter['by_creation_date_from'] = " AND TCV.creation_ts >= {$db_date} ";
 }
 if (!is_null($args->creation_date_to)) {
     $db_date = $db->db->DBdate($args->creation_date_to);
     $filter['by_creation_date_to'] = " AND TCV.creation_ts <= {$db_date} ";
 }
 if ($args->targetTestCase != "" && strcmp($args->targetTestCase, $gui->tcasePrefix) != 0) {
     if (strpos($args->targetTestCase, $tcase_cfg->glue_character) === false) {
         $args->targetTestCase = $gui->tcasePrefix . $args->targetTestCase;
     }
     $tcase_mgr = new testcase($db);
     $tcaseID = $tcase_mgr->getInternalID($args->targetTestCase, $tcase_cfg->glue_character);
     $filter['by_tc_id'] = " AND NH_TCV.parent_id = {$tcaseID} ";
 } else {
     $tproject_mgr->get_all_testcases_id($args->tprojectID, $a_tcid);
     $filter['by_tc_id'] = " AND NH_TCV.parent_id IN (" . implode(",", $a_tcid) . ") ";
 }
 if ($args->version) {
     $filter['by_version'] = " AND TCV.version = {$args->version} ";
 }
 if ($args->keyword_id) {
     $from['by_keyword_id'] = " JOIN {$tables['testcase_keywords']} KW ON KW.testcase_id = NH_TC.id ";
     $filter['by_keyword_id'] = " AND KW.keyword_id = {$args->keyword_id} ";
 }
 if ($args->name != "") {
     $args->name = $db->prepare_string($args->name);
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:31,代码来源:tcSearch.php


示例9: create_tc_from_requirement

 function create_tc_from_requirement($mixIdReq, $srs_id, $user_id, $tproject_id = null, $tc_count = null)
 {
     $debugMsg = 'Class:' . __CLASS__ . ' - Method: ' . __FUNCTION__;
     $tcase_mgr = new testcase($this->db);
     $tsuite_mgr = new testsuite($this->db);
     $req_cfg = config_get('req_cfg');
     $field_size = config_get('field_size');
     $auto_testsuite_name = $req_cfg->default_testsuite_name;
     $node_descr_type = $this->tree_mgr->get_available_node_types();
     $empty_steps = null;
     $empty_preconditions = '';
     // fix for BUGID 2995
     $labels['tc_created'] = lang_get('tc_created');
     $output = null;
     $reqSet = is_array($mixIdReq) ? $mixIdReq : array($mixIdReq);
     /* contribution BUGID 2996, testcase creation */
     if (is_null($tproject_id) || $tproject_id == 0) {
         $tproject_id = $this->tree_mgr->getTreeRoot($srs_id);
     }
     if ($req_cfg->use_req_spec_as_testsuite_name) {
         $full_path = $this->tree_mgr->get_path($srs_id);
         $addition = " (" . lang_get("testsuite_title_addition") . ")";
         $truncate_limit = $field_size->testsuite_name - strlen($addition);
         // REQ_SPEC_A
         //           |-- REQ_SPEC_A1
         //                          |-- REQ_SPEC_A2
         //                                         |- REQ100
         //                                         |- REQ101
         //
         // We will try to check if a test suite has already been created for
         // top REQ_SPEC_A  (we do search using automatic generated name as search criteria).
         // If not => we need to create all path till leaves (REQ100 and REQ200)
         //
         //
         // First search: we use test project
         $parent_id = $tproject_id;
         $deep_create = false;
         foreach ($full_path as $key => $node) {
             // follow hierarchy of test suites to create
             $tsuiteInfo = null;
             $testsuite_name = substr($node['name'], 0, $truncate_limit) . $addition;
             if (!$deep_create) {
                 // child test suite with this name, already exists on current parent ?
                 // At first a failure we will not check anymore an proceed with deep create
                 $sql = "/* {$debugMsg} */ SELECT id,name FROM {$this->tables['nodes_hierarchy']} NH " . " WHERE name='" . $this->db->prepare_string($testsuite_name) . "' " . " AND node_type_id=" . $node_descr_type['testsuite'] . " AND parent_id = {$parent_id} ";
                 // If returns more that one record use ALWAYS first
                 $tsuiteInfo = $this->db->fetchRowsIntoMap($sql, 'id');
             }
             if (is_null($tsuiteInfo)) {
                 $tsuiteInfo = $tsuite_mgr->create($parent_id, $testsuite_name, $req_cfg->testsuite_details);
                 $output[] = sprintf(lang_get('testsuite_name_created'), $testsuite_name);
                 $deep_create = true;
             } else {
                 $tsuiteInfo = current($tsuiteInfo);
                 $tsuite_id = $tsuiteInfo['id'];
             }
             $tsuite_id = $tsuiteInfo['id'];
             // last value here will be used as parent for test cases
             $parent_id = $tsuite_id;
         }
         $output[] = sprintf(lang_get('created_on_testsuite'), $testsuite_name);
     } else {
         // don't use req_spec as testsuite name
         // Warning:
         // We are not maintaining hierarchy !!!
         $sql = " SELECT id FROM {$this->tables['nodes_hierarchy']} NH " . " WHERE name='" . $this->db->prepare_string($auto_testsuite_name) . "' " . " AND parent_id=" . $testproject_id . " " . " AND node_type_id=" . $node_descr_type['testsuite'];
         $result = $this->db->exec_query($sql);
         if ($this->db->num_rows($result) == 1) {
             $row = $this->db->fetch_array($result);
             $tsuite_id = $row['id'];
             $label = lang_get('created_on_testsuite');
         } else {
             // not found -> create
             tLog('test suite:' . $auto_testsuite_name . ' was not found.');
             $new_tsuite = $tsuite_mgr->create($testproject_id, $auto_testsuite_name, $req_cfg->testsuite_details);
             $tsuite_id = $new_tsuite['id'];
             $label = lang_get('testsuite_name_created');
         }
         $output[] = sprintf($label, $auto_testsuite_name);
     }
     /* end contribution */
     // create TC
     $createOptions = array();
     $createOptions['check_names_for_duplicates'] = config_get('check_names_for_duplicates');
     $createOptions['action_on_duplicate_name'] = config_get('action_on_duplicate_name');
     $testcase_importance_default = config_get('testcase_importance_default');
     // compute test case order
     $testcase_order = config_get('treemenu_default_testcase_order');
     $nt2exclude = array('testplan' => 'exclude_me', 'requirement_spec' => 'exclude_me', 'requirement' => 'exclude_me');
     $siblings = $this->tree_mgr->get_children($tsuite_id, $nt2exclude);
     if (!is_null($siblings)) {
         $dummy = end($siblings);
         $testcase_order = $dummy['node_order'];
     }
     foreach ($reqSet as $reqID) {
         $reqData = $this->get_by_id($reqID, requirement_mgr::LATEST_VERSION);
         $count = !is_null($tc_count) ? $tc_count[$reqID] : 1;
         $reqData = $reqData[0];
         // Generate name with progessive
         $instance = 1;
//.........这里部分代码省略.........
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:101,代码来源:requirement_mgr.class.php


示例10: exportTestSuiteDataToXML

 function exportTestSuiteDataToXML($container_id, $tproject_id, $optExport = array())
 {
     static $keywordMgr;
     static $getLastVersionOpt = array('output' => 'minimun');
     static $tcase_mgr;
     if (is_null($keywordMgr)) {
         $keywordMgr = new tlKeyword();
     }
     $xmlTC = null;
     $doRecursion = isset($optExport['RECURSIVE']) ? $optExport['RECURSIVE'] : 0;
     if ($doRecursion) {
         $cfXML = null;
         $kwXML = null;
         $tsuiteData = $this->get_by_id($container_id);
         if (isset($optExport['KEYWORDS']) && $optExport['KEYWORDS']) {
             $kwMap = $this->getKeywords($container_id);
             if ($kwMap) {
                 $kwXML = "<keywords>" . $keywordMgr->toXMLString($kwMap, true) . "</keywords>";
             }
         }
         if (isset($optExport['CFIELDS']) && $optExport['CFIELDS']) {
             $cfMap = (array) $this->get_linked_cfields_at_design($container_id, null, null, $tproject_id);
             if (count($cfMap) > 0) {
                 $cfXML = $this->cfield_mgr->exportValueAsXML($cfMap);
             }
         }
         $xmlTC = "<testsuite name=\"" . htmlspecialchars($tsuiteData['name']) . '" >' . "\n<node_order><![CDATA[{$tsuiteData['node_order']}]]></node_order>\n" . "<details><![CDATA[{$tsuiteData['details']}]]> \n{$kwXML}{$cfXML}</details>";
     } else {
         $xmlTC = "<testcases>";
     }
     $test_spec = $this->get_subtree($container_id, self::USE_RECURSIVE_MODE);
     $childNodes = isset($test_spec['childNodes']) ? $test_spec['childNodes'] : null;
     $tcase_mgr = null;
     if (!is_null($childNodes)) {
         $loop_qty = sizeof($childNodes);
         for ($idx = 0; $idx < $loop_qty; $idx++) {
             $cNode = $childNodes[$idx];
             $nTable = $cNode['node_table'];
             if ($doRecursion && $nTable == 'testsuites') {
                 $xmlTC .= $this->exportTestSuiteDataToXML($cNode['id'], $tproject_id, $optExport);
             } else {
                 if ($nTable == 'testcases') {
                     if (is_null($tcase_mgr)) {
                         $tcase_mgr = new testcase($this->db);
                     }
                     $xmlTC .= $tcase_mgr->exportTestCaseDataToXML($cNode['id'], testcase::LATEST_VERSION, $tproject_id, true, $optExport);
                 }
             }
         }
     }
     $xmlTC .= $doRecursion ? "</testsuite>" : "</testcases>";
     return $xmlTC;
 }
开发者ID:moraesmv,项目名称:testlink-code,代码行数:53,代码来源:testsuite.class.php


示例11: testlinkInitPage

require_once 'users.inc.php';
require_once 'exttable.class.php';
require_once 'exec.inc.php';
// used for bug string lookup
if (config_get('interface_bugs') != 'NO') {
    require_once TL_ABS_PATH . 'lib' . DIRECTORY_SEPARATOR . 'bugtracking' . DIRECTORY_SEPARATOR . 'int_bugtracking.php';
}
testlinkInitPage($db, true, false, "checkRights");
$templateCfg = templateConfiguration();
$resultsCfg = config_get('results');
$statusCode = $resultsCfg['status_code'];
$args = init_args($statusCode);
$gui = initializeGui($statusCode, $args);
$tplan_mgr = new testplan($db);
$tproject_mgr = new testproject($db);
$tcase_mgr = new testcase($db);
$tplan_info = $tplan_mgr->get_by_id($args->tplan_id);
$tproject_info = $tproject_mgr->get_by_id($args->tproject_id);
$getOpt = array('outputFormat' => 'map');
$gui->platformSet = $tplan_mgr->getPlatforms($args->tplan_id, $getOpt);
$show_platforms = !is_null($gui->platformSet);
if (is_null($gui->platformSet)) {
    $gui->platformSet = array('');
}
$gui->bugInterfaceOn = config_get('bugInterfaceOn');
$bugInterface = null;
if ($gui->bugInterfaceOn) {
    $bugInterface = config_get('bugInterface');
}
$labels = init_labels(array('deleted_user' => null, 'design' => null, 'execution' => null));
$gui->tplan_name = $tplan_info['name'];
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:31,代码来源:resultsByStatus.php


示例12: testlinkInitPage

 * @author Francisco Mancardi
 *
 * With this page you can launch a set of available methods, to understand
 * and have inside view about return type .
 *
 * @internal revisions
 *
 */
require_once '../../../config.inc.php';
require_once 'common.php';
require_once 'tree.class.php';
// require_once('dBug.php');
testlinkInitPage($db);
echo "<pre> testcase - constructor - testcase(&\$db)";
echo "</pre>";
$tcase_mgr = new testcase($db);
// new dBug($tcase_mgr);
try {
    $fullEID = 'PTJ09-1';
    echo '<br>Testing getInternalID with fullEID<br>';
    $va = $tcase_mgr->getInternalID($fullEID);
    new dBug($va);
} catch (Exception $e) {
    echo 'Message: ' . $e->getMessage();
}
try {
    $EID = 1;
    echo '<br>Testing getInternalID with ONLY NUMERIC EID<br>';
    $va = $tcase_mgr->getInternalID($EID);
    new dBug($va);
} catch (Exception $e) {
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:31,代码来源:testcase.class.test.php


示例13: error_reporting

error_reporting(0);
require dirname(__FILE__) . '/../../vendor/autoload.php';
require dirname(__FILE__) . '/../../vendor/predis/predis/src/Autoloader.php';
require dirname(__FILE__) . '/../../class/testcase.php';
require dirname(__FILE__) . '/../../config/testUI/config.php';
require dirname(__FILE__) . '/../../class/db.class.php';
Predis\Autoloader::register();
$redis = new Predis\Client($_config['redis_server']);
//读取case目录的文件,将测试用例写到队列。
$fileArray = scandir($_config['case_dir']);
foreach ($fileArray as $file) {
    if ($file == '.' || $file == '..') {
        continue;
    }
    $count = 0;
    $testcase = new testcase($_config['case_dir'] . $file);
    $case_data = $testcase->getdata();
    //插入队列
    if (is_array($case_data)) {
        foreach ($case_data as $v) {
            //            echo json_encode($v)."\n";
            $redis->rpush($_config['queue_name'], json_encode($v)) . "\n";
            $count++;
        }
    } else {
        $redis->rpush($_config['queue_name'], json_encode($case_data)) . "\n";
        $count = 1;
    }
    if ($count > 0) {
        list($ui, $suffix) = explode(".", $file);
        echo "测试用例  " . $ui . " ... 初始化成功,共" . $count . "个\n";
开发者ID:mendianchun,项目名称:at,代码行数:31,代码来源:init.php


示例14: processTestCase

/**
 *
 *
 */
function processTestCase(&$dbHandler, $tplEngine, $args, &$gui, $grants, $cfg)
{
    $get_path_info = false;
    $item_mgr = new testcase($dbHandler);
    // has sense only when we work on test case
    $dummy = testcase::getLayout();
    $gui->tableColspan = $dummy->tableToDisplayTestCaseSteps->colspan;
    $gui->viewerArgs['refresh_tree'] = 'no';
    $gui->path_info = null;
    $gui->platforms = null;
    $gui->loadOnCancelURL = '';
    $gui->attachments = null;
    $gui->direct_link = null;
    $gui->steps_results_layout = $cfg['spec']->steps_results_layout;
    $gui->bodyOnUnload = "storeWindowSize('TCEditPopup')";
    if ($args->caller == 'navBar' && !is_null($args->targetTestCase) && strcmp($args->targetTestCase, $args->tcasePrefix) != 0) {
        $args->id = $item_mgr->getInternalID($args->targetTestCase);
        $args->tcversion_id = testcase::ALL_VERSIONS;
        // I've added $args->caller, in order to make clear the logic, because some actions need to be done ONLY
        // when we have arrived to this script because user has requested a search from navBar.
        // Before we have trusted the existence of certain variables (do not think this old kind of approach is good).
        //
        // why strcmp($args->targetTestCase,$args->tcasePrefix) ?
        // because in navBar targetTestCase is initialized with testcase prefix to provide some help to user
        // then if user request search without adding nothing, we will not be able to search.
        // From navBar we want to allow ONLY to search for ONE and ONLY ONE test case ID.
        $gui->viewerArgs['show_title'] = 'no';
        $gui->viewerArgs['display_testproject'] = 1;
        $gui->viewerArgs['display_parent_testsuite'] = 1;
        if (!($get_path_info = $args->id > 0)) {
            $gui->warning_msg = $args->id == 0 ? lang_get('testcase_does_not_exists') : lang_get('prefix_does_not_exists');
        }
    }
    // because we can arrive here from a User Search Request, if args->id == 0 => nothing found
    if ($args->id > 0) {
        if ($get_path_info || $args->show_path) {
            $gui->path_info = $item_mgr->tree_manager->get_full_path_verbose($args->id);
        }
        $platform_mgr = new tlPlatform($dbHandler, $args->tproject_id);
        $gui->platforms = $platform_mgr->getAllAsMap();
        $gui->attachments[$args->id] = getAttachmentInfosFrom($item_mgr, $args->id);
        $gui->direct_link = $item_mgr->buildDirectWebLink($_SESSION['basehref'], $args->id);
        $gui->id = $args->id;
        $identity = new stdClass();
        $identity->id = $args->id;
        $identity->tproject_id = $args->tproject_id;
        $identity->version_id = $args->tcversion_id;
        try {
            $item_mgr->show($tplEngine, $gui, $identity, $grants);
        } catch (Exception $e) {
            echo $e->getMessage();
        }
        exit;
    } else {
        $templateCfg = templateConfiguration();
        // need to initialize search fields
        $xbm = $item_mgr->getTcSearchSkeleton();
        $xbm->warning_msg = lang_get('no_records_found');
        $xbm->pageTitle = lang_get('caption_search_form');
        $xbm->tableSet = null;
        $xbm->doSearch = false;
        $xbm->tproject_id = $args->tproject_id;
        $tplEngine->assign('gui', $xbm);
        $tplEngine->display($templateCfg->template_dir . 'tcSearchResults.tpl');
    }
}
开发者ID:mweyamutsvene,项目名称:testlink,代码行数:70,代码来源:archiveData.php


示例15: init_filter_workflow_status

 /**
  *
  *
  * @internal revisions
  * @since 1.9.14
  * allow multiple selection (if advanced mode)
  */
 private function init_filter_workflow_status()
 {
     $key = 'filter_workflow_status';
     if (!$this->tc_mgr) {
         $this->tc_mgr = new testcase($this->db);
     }
     // handle filter reset
     $selection = $this->args->{$key};
     if (!$selection || $this->args->reset_filters) {
         $selection = null;
     } else {
         $this->do_filtering = true;
     }
     $this->filters[$key] = array('items' => array(), 'selected' => $selection);
     // load domain
     // add "any" string to these types at index 0 as default selection
     $this->filters[$key]['items'] = array(0 => $this->option_strings['any']) + $this->tc_mgr->getWorkFlowStatusDomain();
     $this->filters[$key]['size'] = min(count($this->filters[$key]['items']), self::ADVANCED_FILTER_ITEM_QUANTITY);
     $this->active_filters[$key] = $selection;
 }
开发者ID:mweyamutsvene,项目名称:testlink,代码行数:27,代码来源:tlTestCaseFilterControl.class.php


示例16: saveImportedTCData

function saveImportedTCData(&$db, $tcData, $tproject_id, $container_id, $userID, $kwMap, $duplicatedLogic = array('hitCriteria' => 'name', 'actionOnHit' => null))
{
    static $messages;
    static $fieldSizeCfg;
    static $feedbackMsg;
    static $tcase_mgr;
    static $tproject_mgr;
    static $req_spec_mgr;
    static $req_mgr;
    static $safeSizeCfg;
    static $linkedCustomFields;
    static $tprojectHas;
    static $reqSpecSet;
    static $getVersionOpt;
    static $userObj;
    if (!$tcData) {
        return;
    }
    // $tprojectHas = array('customFields' => false, 'reqSpec' => false);
    $hasCustomFieldsInfo = false;
    $hasRequirements = false;
    if (is_null($messages)) {
        $feedbackMsg = array();
        $messages = array();
        $fieldSizeCfg = config_get('field_size');
        $tcase_mgr = new testcase($db);
        $tproject_mgr = new testproject($db);
        $req_spec_mgr = new requirement_spec_mgr($db);
        $req_mgr = new requirement_mgr($db);
        $userObj = new tlUser();
        $k2l = array('already_exists_updated', 'original_name', 'testcase_name_too_long', 'start_warning', 'end_warning', 'testlink_warning', 'hit_with_same_external_ID');
        foreach ($k2l as $k) {
            $messages[$k] = lang_get($k);
        }
        $messages['start_feedback'] = $messages['start_warning'] . "\n" . $messages['testlink_warning'] . "\n";
        $messages['cf_warning'] = lang_get('no_cf_defined_can_not_import');
        $messages['reqspec_warning'] = lang_get('no_reqspec_defined_can_not_import');
        $feedbackMsg['cfield'] = lang_get('cf_value_not_imported_missing_cf_on_testproject');
        $feedbackMsg['tcase'] = lang_get('testcase');
        $feedbackMsg['req'] = lang_get('req_not_in_req_spec_on_tcimport');
        $feedbackMsg['req_spec'] = lang_get('req_spec_ko_on_tcimport');
        // because name can be changed automatically during item creation
        // to avoid name conflict adding a suffix automatically generated,
        // is better to use a max size < max allowed size
        $safeSizeCfg = new stdClass();
        $safeSizeCfg->testcase_name = $fieldSizeCfg->testcase_name * 0.8;
        // Get CF with scope design time and allowed for test cases linked to this test project
        $linkedCustomFields = $tcase_mgr->cfield_mgr->get_linked_cfields_at_design($tproject_id, 1, null, 'testcase', null, 'name');
        $tprojectHas['customFields'] = !is_null($linkedCustomFields);
        $reqSpecSet = $tproject_mgr->getReqSpec($tproject_id, null, array('RSPEC.id', 'NH.name AS title', 'RSPEC.doc_id as rspec_doc_id', 'REQ.req_doc_id'), 'req_doc_id');
        $tprojectHas['reqSpec'] = !is_null($reqSpecSet) && count($reqSpecSet) > 0;
        $getVersionOpt = array('output' => 'minimun');
        $tcasePrefix = $tproject_mgr->getTestCasePrefix($tproject_id);
    }
    $resultMap = array();
    $tc_qty = sizeof($tcData);
    $userIDCache = array();
    for ($idx = 0; $idx < $tc_qty; $idx++) {
        $tc = $tcData[$idx];
        $name = $tc['name'];
        $summary = $tc['summary'];
        $steps = $tc['steps'];
        // I've changed value to use when order has not been provided
        // from testcase:DEFAULT_ORDER to a counter, because with original solution
        // an issue arise with 'save execution and go next'
        // if use has not provided order I think is OK TestLink make any choice.
        $node_order = isset($tc['node_order']) ? intval($tc['node_order']) : $idx + 1;
        $internalid = $tc['internalid'];
        $preconditions = $tc['preconditions'];
        $exec_type = isset($tc['execution_type']) ? $tc['execution_type'] : TESTCASE_EXECUTION_TYPE_MANUAL;
        $importance = isset($tc['importance']) ? $tc['importance'] : MEDIUM;
        $externalid = $tc['externalid'];
        if (intval($externalid) <= 0) {
            $externalid = null;
        }
        $personID = $userID;
        if (!is_null($tc['author_login'])) {
            if (isset($userIDCache[$tc['author_login']])) {
                $personID = $userIDCache[$tc['author_login']];
            } else {
                $userObj->login = $tc['author_login'];
                if ($userObj->readFromDB($db, tlUser::USER_O_SEARCH_BYLOGIN) == tl::OK) {
                    $personID = $userObj->dbID;
                }
                // I will put always a valid userID on this cache,
                // this way if author_login does not exit, and is used multiple times
                // i will do check for existence JUST ONCE.
                $userIDCache[$tc['author_login']] = $personID;
            }
        }
        $name_len = tlStringLen($name);
        if ($name_len > $fieldSizeCfg->testcase_name) {
            // Will put original name inside summary
            $xx = $messages['start_feedback'];
            $xx .= sprintf($messages['testcase_name_too_long'], $name_len, $fieldSizeCfg->testcase_name) . "\n";
            $xx .= $messages['original_name'] . "\n" . $name . "\n" . $messages['end_warning'] . "\n";
            $summary = nl2br($xx) . $summary;
            $name = tlSubStr($name, 0, $safeSizeCfg->testcase_name);
        }
        $kwIDs = null;
//.........这里部分代码省略.........
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:101,代码来源:tcCreateFromIssueMantisXML.php


示例17: testlinkInitPage

* 
* 	@version 	$Id: gettestcasesummary.php,v 1.4 2010/12/15 21:47:59 mx-julian Exp $
* 	@author 	Francisco Mancardi
* 
*   Used on Add/Remove test case to test plan feature, to display summary via ExtJS tooltip
*
*	@internal Revisions:
*	20091109 - franciscom - BUGID  0002937: add/remove test case hover over test case 
*                                           tooltip replacement with summary 
*/
require_once '../../config.inc.php';
require_once 'common.php';
testlinkInitPage($db);
// BUGID 4066 - take care of proper escaping when magic_quotes_gpc is enabled
$_REQUEST = strings_stripSlashes($_REQUEST);
$tcase_mgr = new testcase($db);
$tcase_id = isset($_REQUEST['tcase_id']) ? $_REQUEST['tcase_id'] : null;
$tcversion_id = isset($_REQUEST['tcversion_id']) ? $_REQUEST['tcversion_id'] : 0;
$info = '';
if (!is_null($tcase_id)) {
    if ($tcversion_id > 0) {
        $tcase = $tcase_mgr->get_by_id($tcase_id, $tcversion_id);
        if (!is_null($tcase)) {
            $tcase = $tcase[0];
        }
    } else {
        $tcase = $tcase_mgr->get_last_version_info($tcase_id);
    }
    $info = $tcase['summary'];
    // <p> and </p> tag at the beginning and the end of summary cause visualization
    // errors -> remove them and add <br> to get a similar effect
开发者ID:moraesmv,项目名称:testlink-code,代码行数:31,代码来源:gettestcasesummary.php


示例18: setUpForBulkExec

function setUpForBulkExec($guiObj)
{
    $guiObj->execStatusValues = testcase::createExecutionResultsMenu();
    if (isset($guiObj->execStatusValues[$guiObj->cfg->tc_status['all']])) {
        unset($guiObj->execStatusValues[$guiObj->cfg->tc_status['all']]);
    }
    $of = web_editor("bulk_exec_notes", $_SESSION['basehref'], $guiObj->cfg->editorCfg);
    $of->Value = getItemTemplateContents('execution_template', $of->InstanceName, null);
    // Magic numbers that can be determined by trial and error
    $guiObj->bulk_exec_notes_editor = $of->CreateHTML(10, 60);
    unset($of);
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:12,代码来源:execSetResults.php


示例19: exportTestSuiteDataToXML

 /**
  * 
  *
  */
 private function exportTestSuiteDataToXML($container, $tproject_id, $tplan_id, $platform_id)
 {
     static $keywordMgr;
     static $getLastVersionOpt = array('output' => 'minimun');
     static $tcaseMgr;
     static $tsuiteMgr;
     static $tcaseExportOptions;
     static $linkedItems;
     if (is_null($keywordMgr)) {
         $tcaseExportOptions = array('CFIELDS' => true, 'KEYWORDS' => true, 'EXEC_ORDER' => 0);
         $keywordMgr = new tlKeyword();
         $tsuiteMgr = new testsuite($this->db);
         $linkedItems = $this->getLinkedItems($tplan_id);
     }
     $xmlTC = null;
     $cfXML = null;
     $kwXML = null;
     if (isset($container['id'])) {
         $kwMap = $tsuiteMgr->getKeywords($container['id']);
         if ($kwMap) {
             $kwXML = "<keywords>" . $keywordMgr->toXMLString($kwMap, true) . "</keywords>";
         }
         $cfMap = (array) $tsuiteMgr->get_linked_cfields_at_design($container['id'], null, null, $tproject_id);
         if (count($cfMap) > 0) {
             $cfXML = $this->cfield_mgr->exportValueAsXML($cfMap);
         }
         $tsuiteData = $tsuiteMgr->get_by_id($container['id']);
         $xmlTC = "\n\t<testsuite name=\"" . htmlspecialchars($tsuiteData['name']) . '" >' . "\n\t\t<node_order><![CDATA[{$tsuiteData['node_order']}]]></node_order>" . "\n\t\t<details><![CDATA[{$tsuiteData['details']}]]>" . "\n\t\t{$kwXML}{$cfXML}</details>";
     }
     $childNodes = isset($container['childNodes']) ? $container['childNodes'] : null;
     if (!is_null($childNodes)) {
         $loop_qty = sizeof($childNodes);
         for ($idx = 0; $idx < $loop_qty; $idx++) {
             $cNode = $childNodes[$idx];
             switch ($cNode['node_table']) {
                 case 'testsuites':
                     $xmlTC .= $this->exportTestSuiteDataToXML($cNode, $tproject_id, $tplan_id, $platform_id);
                     break;
                 case 'testcases':
                     if (is_null($tcaseMgr)) {
                         $tcaseMgr = new testcase($this->db);
                     }
                     // testcase::LATEST_VERSION,
                     $tcaseExportOptions['EXEC_ORDER'] = $linkedItems[$cNode['id']][$platform_id]['node_order'];
                     $xmlTC .= $tcaseMgr->exportTestCaseDataToXML($cNode['id'], $cNode['tcversion_id'], $tproject_id, testcase::NOXMLHEADER, $tcaseExportOptions);
                     break;
             }
         }
     }
     if (isset($container['id'])) {
         $xmlTC .= "</testsuite>";
     }
     return $xmlTC;
 }
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:58,代码来源:testplan.class.php


示例20: process_testcase

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP testplan类代码示例发布时间:2022-05-23
下一篇:
PHP test_question_maker类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap