Esempio n. 1
0
function createBuildForTestLink($versionBuild)
{
    // get version from the chosen build
    ereg("(.+)\\_(.+)", $versionBuild, $regs);
    $release = $regs[1];
    $build = $regs[2];
    if (preg_match("/^3.4/", $versionBuild)) {
        // translate testProject into ID
        $testProjectID = getTestProjectID("ArubaOS");
        // get test release ID
        $testplanID = getTestReleaseID($release, $testProjectID);
        if ($testplanID == "NOT_FOUND") {
            // create Test Release Entry based on ArubaOS version
            $testplanID = createTestRelease($release, $testProjectID);
        }
        // get or create ID for provided Plan/build mapping
        $buildID = getBuildID($build, $testplanID);
        return $buildID;
    } else {
        return "NOT_FOUND";
    }
}
Esempio n. 2
0
function createBuildForTestLink($versionBuild)
{
    // get version from the chosen build
    ereg("(.+)-rn-(.+)\\_(.+)", $versionBuild, $regs);
    $release = $regs[1];
    $build = $regs[3];
    $branch = $regs[2];
    if ($branch == "2.0" || $branch == "3.0" || $branch == "3.1.0") {
        // translate testProject into ID
        $testProjectID = getTestProjectID("Remote Networks");
        // get test release ID
        if ($branch == "2.0") {
            $release = "RN2.0";
        } elseif ($branch == "3.0") {
            $release = "RN3.0";
        } elseif ($branch == "3.1.0") {
            $release = "RN3.1";
        }
        $testplanID = getTestReleaseID($release, $testProjectID);
        if ($testplanID == "NOT_FOUND") {
            // create Test Release Entry based on ArubaOS version
            $testplanID = createTestRelease($release, $testProjectID);
        }
        // get or create ID for provided Plan/build mapping
        $buildID = getBuildID($build, $testplanID);
        return $buildID;
    } else {
        return "NOT_FOUND";
    }
}
Esempio n. 3
0
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;
}