function getBuildID($build, $testplanID) { $connID = connectTLDB(); $sql = "select " . "id " . "from " . "builds " . "where " . "active=1 and " . "is_open=1 and " . "name='" . $build . "' and " . "testplan_id=" . $testplanID; $rs = mysql_query($sql); // build exists, return its ID if (mysql_num_rows($rs)) { mysql_close($connID); return $build . " already exists."; } else { $sql = "insert into builds " . "(testplan_id, notes, name) " . "values (" . $testplanID . ", " . "'Ported from AOS 5.0.0 (Infinity)', '" . $build . "')"; mysql_query($sql); mysql_close($connID); return $build . " is created."; } }
function createAutomatedSuite($testProject, $testProjectID) { $connID = connectTLDB(); $sql = "select " . "id " . "from " . "nodes_hierarchy " . "where " . "node_type_id=2 and " . "name='" . $testProject . "-Automated' and " . "parent_id=" . $testProjectID; $rs = mysql_query($sql); // Automated suite exists, return its ID if (mysql_num_rows($rs)) { $row = mysql_fetch_array($rs); return $row[0]; // suite needs to be created } else { $sql = "insert " . "into " . "nodes_hierarchy " . "(name, parent_id, node_type_id, node_order) " . "values ('" . $testProject . "-Automated', " . $testProjectID . ", " . "2, " . "1 " . ")"; $rs = mysql_query($sql); // retrieve new suiteID $sql = "select " . "id " . "from " . "nodes_hierarchy " . "where " . "name='" . $testProject . "-Automated' and " . "parent_id =" . $testProjectID . " and " . "node_type_id=2"; $rs = mysql_query($sql); if (mysql_num_rows($rs)) { $row = mysql_fetch_array($rs); $testsuiteID = $row[0]; } else { $testsuiteID = "NOT_FOUND"; } mysql_close($connID); return $testsuiteID; } }