import test step from test link

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
mikimichele82
Posts: 1
Joined: 19 Nov 2014, 10:42

import test step from test link

Post by mikimichele82 »

Good morning,
I'm new in mantis, and I have a question: it's possible to import the test steps in mantis directly from testlink? Or at least insert a direct link to testlink?

The developer team reading the bugs on mantis need to replicate the test case, and if it's not possible to link the steps case the tester should write all the steps again in mantis.

There is any solutions?


Thanks in advance
Nolkyz
Posts: 17
Joined: 18 Sep 2014, 12:44
Location: France

Re: import test step from test link

Post by Nolkyz »

Yes in your testlink folder go to : lib/execute
Then open bugAdd.php and edit addIssue function like it :

Code: Select all

function addIssue($dbHandler, $argsObj, $itsObj){
	$opOK 		= false;             
	$msg 			= '';
	$resultsCfg	= config_get('results');                      
	$tcaseMgr 	= new testcase($dbHandler);
	$dummy 		= $tcaseMgr->tree_manager->get_node_hierarchy_info($argsObj->tcversion_id);
	$auditSign 	= $tcaseMgr->getAuditSignature((object)array('id' => $dummy['parent_id'])); 
	$exec 			= current($tcaseMgr->getExecution($argsObj->exec_id, $argsObj->tcversion_id));
	$dummy 		= $exec['status'];
	if(isset($resultsCfg['code_status'][$exec['status']])){
		$dummy = $resultsCfg['code_status'][$exec['status']];  
	}                        
	$exec['statusVerbose'] = sprintf(lang_get('issue_exec_result'),$dummy);
  
	unset($tcaseMgr);
        //START HERE
	$chaine 		= explode("/", $auditSign);
	$chaine2 	= explode(":", end($chaine));
	$chaine3 	= explode("-", $chaine2[0]);
	array_pop($chaine3);
	$chaine4 	= implode("-", $chaine3);
	$signature 	= sprintf(lang_get('issue_generated_description'), "http://ldc-rct-mantis/testlink/linkto.php?tprojectPrefix=" . $chaine4 . "&item=testcase&id=" . $chaine2[0], $argsObj->exec_id,$exec['tester_login'],$exec['testplan_name']);
       //END HERE
	if($exec['platform_id'] > 0){
		$signature .= sprintf(lang_get('issue_platform'), $exec['platform_name']);
	}
	$signature .= sprintf(lang_get('issue_build') . lang_get('execution_ts_iso'), $exec['build_name'], $exec['execution_ts']) . "\n" . $exec['statusVerbose'] . "\n\n" . $exec['execution_notes'];
	$rs = $itsObj->addIssue($auditSign . ' - ' . sprintf(lang_get('execution_ts_iso'), $exec['execution_ts']), $signature);  
	if($rs['status_ok']){                   
		$msg 		= $rs['msg'];
		$opOK 	= true;
		if(write_execution_bug($dbHandler, $argsObj->exec_id, $rs['id'])){
			logAuditEvent(TLS("audit_executionbug_added", $rs['id']), "CREATE", $argsObj->exec_id, "executions");
		}
	} else {
		$msg = $rs['msg'];
	}
	return array($opOK,$msg);
}
And when you add a bug in Mantis with testlink you'll get a link to test case.

Enjoy.
schoenrock
Posts: 1
Joined: 28 Apr 2015, 09:52

Re: import test step from test link

Post by schoenrock »

Hello,

at first thanks for the code.
We use it for our TestLink 1.9.9 and we have a question.
If we use the link from mantis the test case is shown in TestLink at test specification.
Is it also possible that the link shows us the test case at test execution?

Greetings
Post Reply