Skip to content
Permalink
Browse files

feature: #0008651: add Option when creating issue - link to execution…

… with test case details
  • Loading branch information...
fmancardi committed Apr 26, 2019
1 parent 498cc54 commit 2e55da83de1dbfe3ab5c475d9b4ad93c06e8dd12
@@ -1037,11 +1037,9 @@
// save_and_move = 'unlimited'
$tlCfg->exec_cfg->exec_mode->save_and_move='unlimited';
/**
* @since 1.9.17
*
*/
$tlCfg->exec_cfg->exec_mode->addLinkToTLChecked = false;
$tlCfg->exec_cfg->exec_mode->addLinkToTLPrintViewChecked = false;
/** User filter in Test Execution navigator - default value */
// logged_user -> combo will be set to logged user
@@ -12,7 +12,7 @@ TestLink Open Source Project - http://testlink.sourceforge.net/
{lang_get var='labels'
s='title_bug_add,link_bts_create_bug,bug_id,notes,hint_bug_notes,
btn_close,btn_add_bug,btn_save,bug_summary,
add_link_to_tlexec,
add_link_to_tlexec,add_link_to_tlexec_print_view,
issueType,issuePriority,artifactVersion,artifactComponent'}


@@ -112,6 +112,10 @@ TestLink Open Source Project - http://testlink.sourceforge.net/
<input type="checkbox" name="addLinkToTL" id="addLinkToTL"
{if $gui->addLinkToTLChecked} checked {/if} >
<span class="label">{$labels.add_link_to_tlexec}</span>
<br>
<input type="checkbox" name="addLinkToTLPrintView" id="addLinkToTLPrintView"
{if $gui->addLinkToTLPrintViewChecked} checked {/if} >
<span class="label">{$labels.add_link_to_tlexec_print_view}</span>
{/if}

<div class="groupBtn">
@@ -20,7 +20,7 @@ TestLink Open Source Project - http://testlink.sourceforge.net/
s='created_by,saveStepsForPartialExec,partialExecNoAttachmentsWarning,
edit_notes,build_is_closed,test_cases_cannot_be_executed,test_exec_notes,test_exec_result,btn_next,
th_testsuite,details,warning_delete_execution,title_test_case,th_test_case_id,keywords,design,execution,partialExecNothingToSave,
version,has_no_assignment,assigned_to,execution_history,exec_notes,step_actions,add_link_to_tlexec,
version,has_no_assignment,assigned_to,execution_history,exec_notes,step_actions,add_link_to_tlexec,add_link_to_tlexec_print_view,
execution_type_short_descr,expected_results,testcase_customfields,builds_notes,
estimated_execution_duration,version,btn_save_and_exit,test_plan_notes,bug_copy_from_latest_exec,btn_next_tcase,
last_execution,exec_any_build,date_time_run,test_exec_by,build,exec_status,
@@ -242,6 +242,15 @@ Author : franciscom
</td>
</tr>

<tr>
<td colspan="2">
<input type="checkbox" name="addLinkToTLPrintView"
id="addLinkToTLPrintView"
{if $gui->addLinkToTLPrintViewChecked} checked {/if} >
<span class="label">{$args_labels.add_link_to_tlexec_print_view}</span>
</td>
</tr>

</table>

</br>
@@ -267,6 +267,15 @@ Author : franciscom
</td>
</tr>

<tr>
<td colspan="2">
<input type="checkbox" name="addLinkToTLPrintView"
id="addLinkToTLPrintView"
{if $gui->addLinkToTLPrintViewChecked} checked {/if} >
<span class="label">{$args_labels.add_link_to_tlexec_print_view}</span>
</td>
</tr>

</table>

</br>
@@ -31,7 +31,11 @@
$dummy = generateIssueText($db,$args,$its);
$gui->bug_summary = $dummy->summary;
$ret = addIssue($db,$args,$its,$args->addLinkToTL);
$aop = array('addLinkToTL' => $args->addLinkToTL,
'addLinkToTLPrintView' => $args->addLinkToTLPrintView);
$ret = addIssue($db,$args,$its,$aop);
$gui->issueTrackerCfg->tlCanCreateIssue = $ret['status_ok'];
$gui->msg = $ret['msg'];
break;
@@ -57,13 +61,18 @@
if($gui->issueTrackerCfg->tlCanAddIssueNote) {
$hasNotes = (strlen($gui->bug_notes) > 0);
// will do call to update issue Notes
if($args->addLinkToTL) {
if($args->addLinkToTL || $args->addLinkToTLPrintView) {
$args->direct_link = getDirectLinkToExec($db,$args->exec_id);
$dummy = generateIssueText($db,$args,$its,$args->addLinkToTL);
$aop = array('addLinkToTL' => $args->addLinkToTL,
'addLinkToTLPrintView' => $args->addLinkToTLPrintView);
$dummy = generateIssueText($db,$args,$its,$aop);
$gui->bug_notes = $dummy->description;
}
if( $args->addLinkToTL || $hasNotes ) {
if( $args->addLinkToTL || $args->addLinkToTLPrintView ||
$hasNotes ) {
$opt = new stdClass();
$opt->reporter = $args->user->login;
$its->addNote($args->bug_id,$gui->bug_notes,$opt);
@@ -128,6 +137,7 @@ function initEnv(&$dbHandler)
"user_action" => array("REQUEST",tlInputParameter::STRING_N,
$user_action['minLengh'],$user_action['maxLengh']),
"addLinkToTL" => array("POST",tlInputParameter::CB_BOOL),
"addLinkToTLPrintView" => array("POST",tlInputParameter::CB_BOOL),
"tcstep_id" => array("REQUEST",tlInputParameter::INT_N),);
$args = new stdClass();
@@ -141,11 +151,16 @@ function initEnv(&$dbHandler)
// it's a checkbox
$args->addLinkToTL = isset($_REQUEST['addLinkToTL']);
$args->addLinkToTLPrintView = isset($_REQUEST['addLinkToTLPrintView']);
$args->user = $_SESSION['currentUser'];
$gui = new stdClass();
$cfg = config_get('exec_cfg');
$gui->addLinkToTLChecked = $cfg->exec_mode->addLinkToTLChecked;
$gui->addLinkToTLPrintViewChecked =
$cfg->exec_mode->addLinkToTLPrintViewChecked;
switch($args->user_action) {
case 'create':
@@ -607,6 +607,7 @@ function init_args(&$dbHandler,$cfgObj) {
$args->addLinkToTL = isset($_REQUEST['addLinkToTL']) ? TRUE : FALSE;
$args->addLinkToTLPrintView = isset($_REQUEST['addLinkToTLPrintView']) ? TRUE : FALSE;
// Do this only on single execution mode
// get issue tracker config and object to manage TestLink - BTS integration
@@ -1337,7 +1338,10 @@ function initializeGui(&$dbHandler,&$argsObj,&$cfgObj,&$tplanMgr,&$tcaseMgr,&$is
$gui = new stdClass();
$gui->tcversionSet = null;
$gui->plugins = null;
$gui->addLinkToTLChecked = $cfgObj->exec_cfg->exec_mode->addLinkToTLChecked;
$gui->addLinkToTLPrintViewChecked = $cfgObj->exec_cfg->exec_mode->addLinkToTLPrintViewChecked;
$k2i = array('import','attachments','exec','edit_exec');
$gui->features = array();
@@ -304,15 +304,21 @@ function write_execution(&$db,&$execSign,&$exec_data,&$issueTracker) {
$execContext->tplan_apikey = $execSign->tplan_apikey;
$execContext->addLinkToTL = $execSign->addLinkToTL;
$execContext->addLinkToTLPrintView =
$execSign->addLinkToTLPrintView;
$execContext->direct_link = $execSign->direct_link;
$execContext->tcstep_id = 0;
// Issue on Test Case
if( isset($exec_data['createIssue']) ) {
completeCreateIssue($execContext,$execSign);
$aop = array('addLinkToTL' => $execContext->addLinkToTL,
'addLinkToTLPrintView' => $execContext->addLinkToTLPrintView);
$addIssueOp['createIssue'] = addIssue($db,$execContext,$issueTracker,
$execContext->addLinkToTL);
$aop);
$addIssueOp['type'] = 'createIssue';
}
@@ -630,8 +636,7 @@ function getBugsForExecutions(&$db,&$bug_interface,$execSet,$raw = null)
/**
*
*/
function addIssue($dbHandler,$argsObj,$itsObj,$addLinkToTL)
{
function addIssue($dbHandler,$argsObj,$itsObj,$opt=null) {
static $my;
if(!$my) {
@@ -644,7 +649,7 @@ function addIssue($dbHandler,$argsObj,$itsObj,$addLinkToTL)
$ret['status_ok'] = true;
$ret['msg'] = '';
$issueText = generateIssueText($dbHandler,$argsObj,$itsObj,$addLinkToTL);
$issueText = generateIssueText($dbHandler,$argsObj,$itsObj,$opt);
$issueTrackerCfg = $itsObj->getCfg();
if(property_exists($issueTrackerCfg, 'issuetype')) {
@@ -741,9 +746,12 @@ function copyIssues(&$dbHandler,$source,$dest)
/**
*
*/
function generateIssueText($dbHandler,$argsObj,$itsObj,$addLinkToTL=false) {
function generateIssueText($dbHandler,$argsObj,$itsObj,$opt=null) {
$ret = new stdClass();
$options = array('addLinkToTL' => false, 'addLinkToTLPrintView' => false);
$options = array_merge($options,(array)$opt);
$opOK = false;
$msg = '';
$resultsCfg = config_get('results');
@@ -853,10 +861,16 @@ function generateIssueText($dbHandler,$argsObj,$itsObj,$addLinkToTL=false) {
$ret->summary = $argsObj->bug_summary;
}
if( $addLinkToTL ) {
if( $options['addLinkToTL'] ) {
$ret->description .= "\n\n" . lang_get('dl2tl') . $argsObj->direct_link;
}
if( $options['addLinkToTLPrintView'] ) {
$ret->description .= "\n\n" . lang_get('dl2tlpv') . $argsObj->basehref .
'lnl.php?type=exec&id=' . $argsObj->exec_id . '&apikey=' .
$exec['testplan_api_key'];
}
return $ret;
}
@@ -3825,7 +3825,11 @@ $TLS_security_check_ko = 'Security check failed';
$TLS_issue_on_step = "Issue Executing Step number ";

$TLS_add_link_to_tlexec = "Add Link in Issue Tracker to Test Case Execution Feature";
$TLS_add_link_to_tlexec_print_view = "Add Link in Issue Tracker to Test Case Execution Print View";

$TLS_dl2tl = 'Link to TestLink Execution: ';
$TLS_dl2tlpv = 'Link to TestLink Execution Print View: ';

$TLS_old_style_login = 'Well known login screen';
$TLS_new_style_login = 'Try the new login screen';

0 comments on commit 2e55da8

Please sign in to comment.
You can’t perform that action at this time.