", "

"); $wobalise = array("", ""); // Retrieves informations about the current test case $sql = "SELECT summary, expected_results FROM tcversions WHERE id={$tcase_id}"; $result = &$db->get_recordset($sql); $tc_info = $result[0]; $summary = str_replace($balise, $wobalise, $tc_info['summary']); $expected_results = str_replace($balise, $wobalise, $tc_info['expected_results']); // Retrieves test case's name $sql = "SELECT parent_id FROM nodes_hierarchy WHERE id = {$tcase_id}"; $parent_id = &$db->fetchOneValue($sql, 'parent_id'); $sql = "SELECT name, parent_id FROM nodes_hierarchy WHERE id={$parent_id}"; $result = &$db->get_recordset($sql); $name = $result[0]['name']; $tsuiteid = $result[0]['parent_id']; $tsuitename = ""; do { $sql = "SELECT name, parent_id, node_type_id FROM nodes_hierarchy WHERE id={$tsuiteid}"; $result = &$db->get_recordset($sql); $node_type = $result[0]['node_type_id']; if($node_type == 1) { $tlproject = $result[0]['name']; break; } else { $tsuitename = "{$result[0]['name']} / {$tsuitename}"; $tsuiteid = $result[0]['parent_id']; } }while(1); // Parameters for Jira entry $jirauser = "testlink"; $userpwd = "gazelle"; $issue_type = 1; $projectname = "GZL"; $jira_summary = "Failed test: {$name}"; $jira_description = "TestLink project: {$tlproject}" . "\nTest suite(s): {$tsuitename}" . "\n\nTEST DESCRIPTION: {$summary}" . "\nEXPECTED RESULTS: {$expected_results}" . "\n\nEXECUTION DETAILS: {$notes}"; // use web services to report bug in Jira $client = new soapClient("http://gazelle.ihe.net/jira/rpc/soap/jirasoapservice-v2?wsdl"); $auth = $client->login($jirauser, $userpwd); $issue = array( "project" => $projectname, "type" => $issue_type, "summary" => $jira_summary, "description" =>$jira_description, "reporter" => $jirauser, ); if($auth) { $remoteIssue = new RemoteIssue(); $remoteIssue = $client->createIssue($auth, $issue); $issueInfo = get_object_vars($remoteIssue); $bug_id = $issueInfo['key']; // link the newly created bug to the current execution if (write_execution_bug($db,$exec_id, $bug_id)) { $msg = "New bug ({$bug_id}) has been successfully recorded for test case {$name}."; logAuditEvent(TLS("audit_executionbug_added",$bug_id),"CREATE",$exec_id,"executions"); } $client->logout(); } $smarty = new TLSmarty(); $smarty->assign('exec_id',$exec_id); $smarty->assign('bug_id', $bug_id); $smarty->assign('msg',$msg); $smarty->display($template_dir . $default_template); // check User is allowed to add information to current test plan function checkRights(&$db,&$user) { return $user->hasRight($db,"testplan_execute"); } ?>