Example #1
0
function PrintFailStateTable($dailytest_id, $testsuiteid)
{
    $sql = "select color,state from st_state";
    $states = DoSql($sql);
    $num_s = $states->num_rows;
    $state_to_color = array();
    for ($state = 0; $state < $num_s; $state++) {
        $row = $states->fetch_assoc();
        $state_to_color[$row['state']] = $row['color'];
    }
    $states->free();
    //FAIL 状态的统计表
    $message = "";
    $message .= '<table class="altrowstable" width="60%">' . "\n";
    $message .= "<tr bgcolor=\"#ffffff\" align=\"center\" ><th colspan=\"3\">Fail State Table</th></tr>\n";
    $message .= "<tr bgcolor=\"#d2d2d2\" align=\"center\">\n";
    $message .= "<td width=\"20%\">Testsuite</td><td>Description</td><td width=\"10%\">State</td>\n";
    $message .= "</tr>\n";
    if ($testsuiteid == 0) {
        $sql = "select st_testsuite.testsuite as testsuite\n            from st_stateresult,st_dailytest,st_testcase,st_state,st_testsuite\n            where st_dailytest.dailytest_id='{$dailytest_id}'\n            and st_dailytest.dailytest_id=st_stateresult.dailytest_id\n            and st_stateresult.testcase_id=st_testcase.testcase_id\n            and st_state.state_id=st_stateresult.state_id and (state='FAIL' or state='Warning')\n            and st_testcase.testsuite_id=st_testsuite.testsuite_id\n            group by testsuite";
    } else {
        $sql = "select st_testsuite.testsuite as testsuite\n            from st_stateresult,st_dailytest,st_testcase,st_state,st_testsuite\n            where st_dailytest.dailytest_id='{$dailytest_id}'\n            and st_dailytest.dailytest_id=st_stateresult.dailytest_id\n            and st_stateresult.testcase_id=st_testcase.testcase_id\n            and st_state.state_id=st_stateresult.state_id and (state='FAIL' or state='Warning')\n            and st_testcase.testsuite_id=st_testsuite.testsuite_id\n            and st_testsuite.testsuite_id = '{$testsuiteid}'\n            group by testsuite";
    }
    Debug("\n[" . __FILE__ . "][" . __LINE__ . "]:\n" . $sql . "\n");
    $testsuiteresult = Dosql($sql);
    $num_ts = $testsuiteresult->num_rows;
    $failtestsuite = array();
    for ($i = 0; $i < $num_ts; $i++) {
        $row = $testsuiteresult->fetch_assoc();
        $failtestsuite[$i] = $row['testsuite'];
        //所有有fail状态的testsuite的数组
    }
    $testsuiteresult->free();
    foreach ($failtestsuite as $num_ts => $testsuite) {
        $sql = "select testdate,st_testcase.description as description,state,st_testsuite.testsuite as testsuite\n            from st_stateresult,st_testcase,st_state,st_dailytest,st_testsuite\n            where\n                st_dailytest.dailytest_id=st_stateresult.dailytest_id and\n                st_stateresult.dailytest_id='{$dailytest_id}' and\n                st_stateresult.testcase_id=st_testcase.testcase_id and\n                st_stateresult.state_id=st_state.state_id and\n                (st_state.state='FAIL' or st_state.state='Warning') and\n                st_testcase.testsuite_id=st_testsuite.testsuite_id and\n                st_testsuite.testsuite='{$testsuite}'";
        Debug("\n[" . __FILE__ . "][" . __LINE__ . "]:\n" . $sql . "\n");
        if ($num_ts % 2) {
            $tsbgcolor = "#f2f2f2";
        } else {
            $tsbgcolor = "#ffffff";
        }
        $selresult = Dosql($sql);
        $num_sel = $selresult->num_rows;
        for ($i = 0; $i < $num_sel; $i++) {
            $row = $selresult->fetch_assoc();
            $message .= "<tr bgcolor=\"#ffffff\">\n";
            if ($i == 0) {
                $message .= "<td bgcolor=\"{$tsbgcolor}\" rowspan=\"{$num_sel}\" align=\"center\">{$testsuite}</td>";
            }
            $message .= "<td>" . htmlspecialchars(stripslashes($row['description'])) . "</td>\n";
            $message .= "<td bgcolor=\"" . $state_to_color[$row['state']] . "\" align=\"center\">" . htmlspecialchars(stripslashes($row['state'])) . "</td>\n";
            $message .= "</tr>\n";
        }
        $selresult->free();
    }
    $message .= "</table>\n";
    return $message;
}
Example #2
0
echo "<a href=\"showissuedetail.php?getflag=0&dailytest_id={$dailytestid}\">{$platform} - {$branch} _ ";
echo "{$date}</a> - " . $testsuiteid_to_testsuite[$testsuiteid];
echo "</h3>\n";
?>
</h1>

<link rel="stylesheet" type="text/css" href="/smoketest/css/main.css">
<!--表格 所有fail状态的表格 -->
<table class="altrowstable" width="60%">
<tr bgcolor="#ffffff" align="center" ><th colspan="3">Fail State Table</th></tr>
<tr bgcolor="#d2d2d2" align="center">
<Td width="20%">Testsuite</td><td>Description</td><td width="10%">State</td>
</tr>
<?php 
$sql = "select color,state from st_state";
$states = DoSql($sql);
$num_s = $states->num_rows;
$state_to_color = array();
for ($state = 0; $state < $num_s; $state++) {
    $row = $states->fetch_assoc();
    $state_to_color[$row['state']] = $row['color'];
}
$states->free();
if ($testsuiteid == 0) {
    // 如果过滤了某个模块
    $sql = "select st_testsuite.testsuite as testsuite\n        from st_stateresult,st_dailytest,st_testcase,st_state,st_testsuite\n        where\n        platform='{$platform}'\n        and branch='{$branch}'\n        and testdate='{$date}'\n        and    st_dailytest.dailytest_id=st_stateresult.dailytest_id\n        and    st_dailytest.dailytest_id='{$dailytestid}'\n        and st_stateresult.testcase_id=st_testcase.testcase_id\n        and st_state.state_id=st_stateresult.state_id\n        and (state='FAIL' or state='Warning')\n        and st_testcase.testsuite_id=st_testsuite.testsuite_id\n        group by testsuite";
} else {
    $sql = "select st_testsuite.testsuite as testsuite\n        from st_stateresult,st_dailytest,st_testcase,st_state,st_testsuite\n        where\n        platform='{$platform}'\n        and branch='{$branch}'\n        and testdate='{$date}'\n        and st_dailytest.dailytest_id=st_stateresult.dailytest_id\n        and    st_dailytest.dailytest_id='{$dailytestid}'\n        and st_stateresult.testcase_id=st_testcase.testcase_id\n        and st_state.state_id=st_stateresult.state_id\n        and (state='FAIL' or state='Warning')\n        and st_testcase.testsuite_id=st_testsuite.testsuite_id\n        and st_testsuite.testsuite_id = '{$testsuiteid}'\n        group by testsuite";
}
//end if()
$testsuiteresult = Dosql($sql);
function SearchStateResult_showfailsatetable($platform, $branch, $product, $reportdate)
{
    //<!--表格 所有fail状态的表格 -->
    echo "<table class=\"altrowstable\" width=\"100%\">";
    echo "<tr bgcolor=\"#ffffff\" align=\"center\" ><th colspan=\"3\">Fail State Table</th></tr>";
    echo "<tr bgcolor=\"#d2d2d2\" align=\"center\">";
    echo "<td width=\"20%\">Testsuite</td><td>Description</td><td width=\"10%\">State</td>";
    echo "</tr>";
    $sql = "select color,state from st_state";
    $states = DoSql($sql);
    $num_s = $states->num_rows;
    $state_to_color = array();
    for ($state = 0; $state < $num_s; $state++) {
        $row = $states->fetch_assoc();
        $state_to_color[$row['state']] = $row['color'];
    }
    $states->free();
    if ($product) {
        $sql = "select st_testsuite.testsuite as testsuite\n        from st_stateresult,st_dailytest,st_testcase,st_state,st_testsuite\n        where\n        platform='{$platform}'\n        and branch='{$branch}'\n        and product='{$product}'\n        and testdate='{$reportdate}'\n        and st_dailytest.dailytest_id=st_stateresult.dailytest_id\n        and st_stateresult.testcase_id=st_testcase.testcase_id\n        and st_state.state_id=st_stateresult.state_id and (state='FAIL' or state='Warning')\n        and st_testcase.testsuite_id=st_testsuite.testsuite_id\n        group by testsuite";
    } else {
        $sql = "select st_testsuite.testsuite as testsuite\n        from st_stateresult,st_dailytest,st_testcase,st_state,st_testsuite\n        where\n        platform='{$platform}'\n        and branch='{$branch}'\n        and testdate='{$reportdate}'\n        and st_dailytest.dailytest_id=st_stateresult.dailytest_id\n        and st_stateresult.testcase_id=st_testcase.testcase_id\n        and st_state.state_id=st_stateresult.state_id and (state='FAIL' or state='Warning')\n        and st_testcase.testsuite_id=st_testsuite.testsuite_id\n        group by testsuite";
    }
    $testsuiteresult = Dosql($sql);
    $num_ts = $testsuiteresult->num_rows;
    for ($i = 0; $i < $num_ts; $i++) {
        $row = $testsuiteresult->fetch_assoc();
        $failtestsuite[$i] = $row['testsuite'];
    }
    $testsuiteresult->free();
    foreach ($failtestsuite as $num_ts => $testsuite) {
        if ($product) {
            $sql = "select testdate,st_testcase.description as description, state, st_testsuite.testsuite as testsuite\n            from st_testsuite,st_stateresult,st_dailytest,st_testcase,st_state\n            where\n            platform='{$platform}'\n            and branch='{$branch}'\n            and product='{$product}'\n            and testdate='{$reportdate}'\n            and st_dailytest.dailytest_id=st_stateresult.dailytest_id\n            and    st_stateresult.testcase_id=st_testcase.testcase_id\n            and st_state.state_id=st_stateresult.state_id\n            and (state='FAIL' or state='Warning')\n            and st_testcase.testsuite_id=st_testsuite.testsuite_id\n            and st_testsuite.testsuite='{$testsuite}'";
        } else {
            $sql = "select testdate,st_testcase.description as description, state, st_testsuite.testsuite as testsuite\n            from st_testsuite,st_stateresult,st_dailytest,st_testcase,st_state\n            where\n            platform='{$platform}'\n            and branch='{$branch}'\n            and testdate='{$reportdate}'\n            and st_dailytest.dailytest_id=st_stateresult.dailytest_id\n            and    st_stateresult.testcase_id=st_testcase.testcase_id\n            and st_state.state_id=st_stateresult.state_id\n            and (state='FAIL' or state='Warning')\n            and st_testcase.testsuite_id=st_testsuite.testsuite_id\n            and st_testsuite.testsuite='{$testsuite}'";
        }
        if ($num_ts % 2) {
            $tsbgcolor = "#f2f2f2";
        } else {
            $tsbgcolor = "#ffffff";
        }
        $selresult = Dosql($sql);
        $num_sel = $selresult->num_rows;
        for ($i = 0; $i < $num_sel; $i++) {
            $row = $selresult->fetch_assoc();
            echo "<tr bgcolor=\"#ffffff\">\n";
            if ($i == 0) {
                echo "<td bgcolor=\"{$tsbgcolor}\" rowspan=\"{$num_sel}\" align=\"center\" >{$testsuite}</td>";
            }
            echo "<td>" . htmlspecialchars(stripslashes($row['description'])) . "</td>\n";
            echo "<td bgcolor=\"" . $state_to_color[$row['state']] . "\" align=\"center\">" . htmlspecialchars(stripslashes($row['state'])) . "</td>\n";
            echo "</tr>\n";
        }
        $selresult->free();
    }
    echo "</table>\n";
}