$context->testplanid = 279348;
// $context->buildid=1;
$context->buildname = '2.0';
$context->platformname = 'PLAT01';
$context->testcaseexternalid = 'ZQ-3';
// $context->testcaseid=null;
$exec = new stdClass();
$exec->status = $tcaseStatusCode['blocked'];
$exec->notes = "Call using all EXTERNAL ID ({$context->testcaseexternalid}) - status={$exec->status}";
$exec->customfields = null;
$exec->bugid = null;
$exec->timestamp = '2015-09-07 12:00:00';
$exec->overwrite = false;
$debug = false;
echo $unitTestDescription;
$response = executeTestCase($server_url, $context, $exec, $debug);
echo "<br> Result was: ";
new dBug($response);
echo "<br>";
/*
  function: 
  args:
  
  returns: 
*/
function executeTestCase($server_url, $context, $exec, $debug = false)
{
    new dBug($context);
    new dBug($exec);
    $client = new IXR_Client($server_url);
    $client->debug = $debug;
コード例 #2
0
ファイル: execSetResults.php プロジェクト: viglesiasce/tl_RC1
function do_remote_execution(&$db, $tc_versions)
{
    $resultsCfg = config_get('results');
    $tc_status = $resultsCfg['status_code'];
    $tree_mgr = new tree($db);
    $cfield_mgr = new cfield_mgr($db);
    $ret = array();
    $ret["status"] = array();
    $ret["notes"] = array();
    $executionResults = array();
    $myResult = array();
    foreach ($tc_versions as $version_id => $tcase_id) {
        // RPC call
        $executionResults[$tcase_id] = executeTestCase($tcase_id, $tree_mgr, $cfield_mgr);
        if ($executionResults) {
            $myResult = $executionResults[$tcase_id]['result'];
            $myNotes = $executionResults[$tcase_id]['notes'];
            if ($myResult != -1 && $myNotes != -1) {
                $db_now = $db->db_now();
                $my_notes = $db->prepare_string(trim($myNotes));
                $my_result = strtolower($myResult);
                $my_result = $my_result[0];
                if ($my_result != $tc_status['passed'] && $my_result != $tc_status['failed'] && $my_result != $tc_status['blocked']) {
                    $my_result = $tc_status['blocked'];
                }
                //
                $ret["status"][$version_id] = $myResult;
                $ret["notes"][$version_id] = $my_notes;
                //
                $sql = "INSERT INTO executions (build_id,tester_id,status,testplan_id,tcversion_id,execution_ts,notes) " . "VALUES ({$build_id},{$user_id},'{$my_result}',{$tplan_id},{$version_id},{$db_now},'{$my_notes}')";
                $db->exec_query($sql);
            }
        }
    }
    return $ret;
}
コード例 #3
0
ファイル: tcExecute.php プロジェクト: tamtrong/testlink
function remote_exec_testcase_set(&$db, $parent_id, $msg)
{
    $cfield_manager = new cfield_mgr($db);
    $tree_manager = new tree($db);
    $xmlResponse = null;
    $executionResults = array();
    $node_type = $tree_manager->get_available_node_types();
    $subtree_list = $tree_manager->get_subtree($parent_id);
    foreach ($subtree_list as $_key => $_value) {
        if (is_array($_value)) {
            if ($_value['node_type_id'] == $node_type['testcase']) {
                $executionResults[$_value['id']] = executeTestCase($_value['id'], $tree_manager, $cfield_manager);
            } else {
                //Can add some logic here. If required.
                continue;
            }
        }
    }
    if ($executionResults) {
        foreach ($executionResults as $key => $value) {
            $node_info = $tree_manager->get_node_hierarchy_info($key);
            $xmlResponse .= '<tr><th colspan="2">' . lang_get('tcexec_results_for') . $node_info['name'] . "</th></tr>";
            $serverTest = 1;
            foreach ($value as $_key => $_value) {
                if ($_value != -1) {
                    $xmlResponse .= "<tr><td>" . $_key . ":</td><td>" . $_value . "</td></tr>";
                } else {
                    $serverTest = $serverTest + 1;
                }
            }
            if ($serverTest != 1) {
                $xmlResponse .= $xmlResponse .= $msg['check_server_setting'];
            }
        }
    }
    return $xmlResponse;
}
コード例 #4
0
function do_remote_execution(&$dbHandler, $context)
{
    $debugMsg = "File:" . __FILE__ . " Function: " . __FUNCTION__;
    $tables = array();
    $tables['executions'] = DB_TABLE_PREFIX . 'executions';
    $resultsCfg = config_get('results');
    $tc_status = $resultsCfg['status_code'];
    $tree_mgr = new tree($dbHandler);
    $cfield_mgr = new cfield_mgr($dbHandler);
    $ret = null;
    $executionResults = array();
    $myResult = array();
    $sql = " /* {$debugMsg} */ INSERT INTO {$tables['executions']} " . " (testplan_id,platform_id,build_id,tester_id,execution_type," . "  tcversion_id,execution_ts,status,notes) " . " VALUES ({$context['tplan_id']}, {$context['platform_id']}, {$context['build_id']}," . " {$context['user_id']}," . testcase::EXECUTION_TYPE_AUTO . ",";
    // have we got multiple test cases to execute ?
    $target =& $context['target'];
    foreach ($target['tc_versions'] as $version_id => $tcase_id) {
        $ret[$version_id] = array("verboseID" => null, "status" => null, "notes" => null, "system" => null, "scheduled" => null, "timestamp" => null);
        $tcaseInfo = $tree_mgr->get_node_hierarchy_info($tcase_id);
        $tcaseInfo['version_id'] = $version_id;
        // For each test case version we can have a different server config
        $serverCfg = $cfield_mgr->getXMLRPCServerParams($version_id, $target['feature_id'][$version_id]);
        $execResult[$version_id] = executeTestCase($tcaseInfo, $serverCfg, $context['context']);
        // RPC call
        $tryWrite = false;
        switch ($execResult[$version_id]['system']['status']) {
            case 'configProblems':
                $tryWrite = false;
                break;
            case 'connectionFailure':
                $tryWrite = false;
                break;
            case 'ok':
                $tryWrite = true;
                break;
        }
        if ($tryWrite) {
            $trun =& $execResult[$version_id]['execution'];
            if ($trun['scheduled'] == 'now') {
                $ret[$version_id]["status"] = strtolower($trun['result']);
                $ret[$version_id]["notes"] = trim($trun['notes']);
                $notes = $dbHandler->prepare_string($ret[$version_id]["notes"]);
                if ($ret[$version_id]["status"] != $tc_status['passed'] && $ret[$version_id]["status"] != $tc_status['failed'] && $ret[$version_id]["status"] != $tc_status['blocked']) {
                    $ret[$version_id]["status"] = $tc_status['blocked'];
                }
                //
                $sql2exec = $sql . $version_id . "," . $dbHandler->db_now() . ", '{$ret[$version_id]["status"]}', '{$notes}' )";
                $dbHandler->exec_query($sql2exec);
            } else {
                $ret[$version_id]["notes"] = trim($execResult[$version_id]['notes']);
                $ret[$version_id]["scheduled"] = $execResult[$version_id]['scheduled'];
                $ret[$version_id]["timestamp"] = $execResult[$version_id]['timestampISO'];
            }
        } else {
            $ret[$version_id]["system"] = $execResult[$version_id]['system'];
        }
    }
    return $ret;
}