$arrDataOAW = getDataForBuild($_GET['buildID'] . "_OAW"); if (!is_array($arrData)) { $errStr = "BUILD '" . $_GET['buildID'] . "' is NOT FOUND!<br>PLEASE SEARCH ANOTHER BUILD!"; } else { $buildTable = createSearchBuildTable($arrData, $_GET['buildID'], $arr[1]); } if (is_array($arrDataOAW)) { $buildTableOAW = createSearchBuildTable($arrDataOAW, $_GET['buildID'] . "_OAW", $arr[1], 1); } $tableHeader = "<tr>\r\n <th style=\"width: 6%\">Build</th>\r\n <th style=\"width: 6%\">Type</th>\r\n <th style=\"width: 3%\">Version</th>\r\n <th style=\"width: 3%\">Platform</th>\r\n <th style=\"width: 3%\">Started</th>\r\n <th style=\"width: 23%\">Total-Pass-Fail</th>\r\n <th style=\"width: 3%\">RunStatus</th>\r\n <th style=\"width: 3%\">Analysis</th>\r\n <th style=\"width: 15%\">Chart</th>\r\n <th style=\"width: 32%\">Comments</th>\r\n <th style=\"width: 3%\">Bugs</th>\r\n\r\n </tr>\r\n <tr><td colspan=\"{\$columnCount}\"></td></tr>\r\n <tr><td colspan=\"{\$columnCount}\"></td></tr>\r\n <tr><td colspan=\"{\$columnCount}\"></td></tr>"; ////////////////////////////////////////////////////////////////////////////////////////////////////// Get Regression Data $buildDataReg = createDataForRegBuild($_GET['buildID']); writeRegBuildCasesToFile($buildDataReg, $_GET['buildID'], ""); $arrDataReg = getDataForRegBuild($_GET['buildID']); // get result for Alcatel build $buildDataOAWReg = createDataForRegBuild($_GET['buildID'] . "_OAW"); if (is_array($buildDataOAWReg)) { writeRegBuildCasesToFile($buildDataOAWReg, $_GET['buildID'] . "_OAW", ""); } $arrDataOAWReg = getDataForRegBuild($_GET['buildID'] . "_OAW"); if (!is_array($arrDataReg)) { $errStrReg = "NO REGRESSION RUNS FOUND FOR BUILD '" . $_GET['buildID'] . "'!"; } else { $buildTableReg = createSearchRegBuildTable($arrDataReg, $_GET['buildID'], $arr[1]); } if (is_array($arrDataOAWReg)) { $buildTableOAWReg = createSearchRegBuildTable($arrDataOAWReg, $_GET['buildID'] . "_OAW", $arr[1], 1); } $tableHeaderReg = "<tr>\r\n <th style=\"width: 3%\">Build</th>\r\n <th style=\"width: 5%\">Type</th>\r\n <th style=\"width: 3%\">Version</th>\r\n <th style=\"width: 3%\">Started</th>\r\n <th style=\"width: 23%\">Total-Pass-Fail</th>\r\n <th style=\"width: 4%\">RunStatus</th>\r\n <th style=\"width: 4%\">Analysis</th>\r\n <th style=\"width: 15%\">Chart</th>\r\n <th style=\"width: 37%\">Comments</th>\r\n <th style=\"width: 4%\">Bugs</th>\r\n </tr>\r\n <tr><td colspan=\"{\$columnCountReg}\"></td></tr>\r\n <tr><td colspan=\"{\$columnCountReg}\"></td></tr>\r\n <tr><td colspan=\"{\$columnCountReg}\"></td></tr>"; ////////////////////////////////////////////////////////////////////////////////////////////////////// Get Rap Smoke Data if ($searchType == "r") {
} elseif ($type == "analysis") { updateAnalysisStatus2($build, $val, $tableQuery); } elseif ($type == "runstatus") { updateRunStatus($build, $val, $tableQuery); } } } if (!ereg("[0-9]+", $_GET['buildID'])) { $errStr = "BUILD ID '" . $_GET['buildID'] . "' is NOT VALID!<br>PLEASE SEARCH ANOTHER BUILD!"; } else { // get data for AOS image $buildData = createDataForRegBuild($_GET['buildID'], $regType); writeRegBuildCasesToFile($buildData, $_GET['buildID'], $regType); $arrData = getDataForRegBuild($_GET['buildID'], $regType); // get result for Alcatel build $buildDataOAW = createDataForRegBuild($_GET['buildID'] . "_OAW", $regType); if (is_array($buildDataOAW)) { writeRegBuildCasesToFile($buildDataOAW, $_GET['buildID'] . "_OAW", $regType); } $arrDataOAW = getDataForRegBuild($_GET['buildID'] . "_OAW", $regType); if (!is_array($arrData)) { $errStr = "BUILD '" . $_GET['buildID'] . "' is NOT FOUND!<br>PLEASE SEARCH ANOTHER BUILD!"; } else { $buildTable = createSearchRegBuildTable($arrData, $_GET['buildID'], $arr[1], 0, $regType); } if (is_array($arrDataOAW)) { $buildTableOAW = createSearchRegBuildTable($arrDataOAW, $_GET['buildID'] . "_OAW", $arr[1], 1, $regType); } } $tableHeader = "<tr>\r\n <th style=\"width: 3%\">Build</th>\r\n <th style=\"width: 5%\">Type</th>\r\n <th style=\"width: 3%\">Version</th>\r\n <th style=\"width: 3%\">Started</th>\r\n <th style=\"width: 23%\">Total-Pass-Fail</th>\r\n <th style=\"width: 4%\">RunStatus</th>\r\n <th style=\"width: 4%\">Analysis</th>\r\n <th style=\"width: 15%\">Chart</th>\r\n <th style=\"width: 37%\">Comments</th>\r\n <th style=\"width: 4%\">Bugs</th>\r\n </tr> \r\n <tr><td colspan=\"{\$columnCount}\"></td></tr>\r\n <tr><td colspan=\"{\$columnCount}\"></td></tr>\r\n <tr><td colspan=\"{\$columnCount}\"></td></tr>"; $smarty = new TLSmarty();
function updateTestLink($build, $testProject, $statusFilter, $catFilter, $comFilter) { // get all case data for this build $buildData = createDataForRegBuild($build); writeTLCasesToFile($buildData); // write to TMP file and include include 'casedata/TLdata' . $build; $cases = array(); if ($catFilter == "All Categories") { $cases = $arrData[builds][$build][cases]; // select cases only for chosen category } elseif ($catFilter != "All Categories" && $comFilter == "All Components") { foreach ($arrData[builds][$build][cases] as $caseID => $case) { if ($case[category] == $catFilter) { $cases[$caseID] = $case; } } // select cases for chosen category/component } elseif ($catFilter != "All Categories" && $comFilter != "All Components") { foreach ($arrData[builds][$build][cases] as $caseID => $case) { if ($case[category] == $catFilter && $case[component] == $comFilter) { $cases[$caseID] = $case; } } // select all cases for all category/component } else { $cases = $arrData[builds][$build][cases]; } // select if ($statusFilter) { $caseArr = array(); foreach ($cases as $caseID => $case) { if ($case[status] == "PASSED") { $caseArr[$caseID] = $case; } } $cases = $caseArr; } // remove generated TMP file $buffShell = shell_exec('rm -r -f /home/psemernin/qa-tl/web/testlink/dashboard/casedata/TLdata' . $build); // open log file for writing $time = date('Y-m-d-H:i:s'); sysLogWrite("Starting TestLink Update on " . date("F j, Y, g:i a") . "\n", $build, $time); // translate testProject into ID $testProjectID = getTestProjectID($testProject); if ($testProjectID == "NOT_FOUND") { sysLogWrite("ERROR: Can't get testProjectID for supplied project name '" . $testProject . "'!", $build, $time); return 0; } // create or check for existing TestProject-Automated subSuite $autoSuiteID = createAutomatedSuite($testProject, $testProjectID); if ($autoSuiteID == "NOT_FOUND") { sysLogWrite("ERROR: Can't get suiteID for '" . $testProject . "-Automated' or Cannot create it!", $build, $time); return 0; } // check for existence or create Automated keyword for this testProject $keywordID = getAutoKeywordID($testProjectID); if ($keywordID == "NOT_FOUND") { sysLogWrite("ERROR: Can't get or create keyword 'Automated'!", $build, $time); return 0; } // get auto userID $testerID = getAutoUserID(); if ($testerID == "NOT_FOUND") { sysLogWrite("ERROR: Can't get userID for 'auto' user!", $build, $time); return 0; } // get version from the chosen build $release = getReleaseFromBuild($build); if ($release == "NOT_FOUND") { sysLogWrite("ERROR: Can't get version for build '" . $build . "'!", $build, $time); return 0; } // get test release ID $testplanID = getTestReleaseID($release, $testProjectID); if ($testplanID == "NOT_FOUND") { // create Test Release Entry based on ArubaOS version $testplanID = createTestRelease($release, $testProjectID); if ($testplanID == "NOT_FOUND") { sysLogWrite("ERROR: Can't create Test Release for '" . $release . "'!", $build, $time); return 0; } } // get or create ID for provided Plan/build mapping $buildID = getBuildID($build, $testplanID); if ($buildID == "NOT_FOUND") { sysLogWrite("ERROR: Can't get or create ID for build '" . $build . "' and testplanID '" . $testplanID . "' !", $build, $time); return 0; } sysLogWrite("Done with administrative tasks. Starting to update Case Execution...", $build, $time); // update status for each case foreach ($cases as $caseID => $case) { // translate case status to TL format $status = translateCaseStatus($case[status]); if ($status == "NOT_FOUND") { sysLogWrite("ERROR: Case Status '" . $status . "' for caseID=" . $caseID . " cannot be TRANSLATED!", $build, $time); } else { sysLogWrite(updateCase($caseID, $buildID, $testProject, $testProjectID, $testplanID, $autoSuiteID, $status, $testerID, $keywordID), $build, $time); } } return "/home/psemernin/qa-tl/web/testlink/dashboard/casedata/API_logs/log-" . $build . "-" . $time; }