[SOLVED] write custom result status using api

Discussion and information for XML-RPC interface.

Moderators: Amaradana, TurboPT, TL Developers

[SOLVED] write custom result status using api

Postby susan » Mon Jul 08, 2013 10:41 am

Hi all,

I'm using Selenium with Java-Api V1.9.6-1 for automated testing. Used Testlink-Version is 1.9.7.

In the custom_config.inc.php file we changed $tlCfg->results in the following way:

$tlCfg->results['status_code'] = array (
"failed_h" => 'h',
"failed_m" => 'm',
"failed_l" => 'l',
"blocked" => 'b',
"passed" => 'p',
"not_run" => 'n',
"not_available" => 'x',
"unknown" => 'u',
"all" => 'a'
);

Now I am not able to write failed testcase results via api to the database, because of the enumeration object used for the execution that only allows FAILED for the result. Is there any way to write the custom result status via api to the testlink-database?

Thanks,

Susanne STeinwender
susan
TestLink user
 
Posts: 8
Joined: Sun Jul 07, 2013 8:22 pm

Re: write custom result status using api

Postby susan » Mon Jul 22, 2013 7:06 am

Maybe someone has the same problem, so here is my solution:

I have edited the file xmlrpc.class.php in the directory testlink/lib/api/xmlrpc/v1 and added the following lines at the beginning of the function check_status:

if (($this->args[self::$statusParamName]) == 'f')
$this->args[self::$statusParamName] = 'm';

Now, all errors that occur during the automated tests are reported with priority 'middle'.

Susan
susan
TestLink user
 
Posts: 8
Joined: Sun Jul 07, 2013 8:22 pm

Re: write custom result status using api

Postby fman » Thu Aug 15, 2013 4:34 pm

You can find the right configuration parameter, here (excerpt from api code)


/**
* An array containing strings for valid statuses
* Will be initialized using user configuration via config_get()
*/
public $statusCode;
public $codeStatus;


/**
* Constructor sets up the IXR_Server and db connection
*/
public function __construct($callbacks = array())
{
$this->dbObj = new database(DB_TYPE);
$this->dbObj->db->SetFetchMode(ADODB_FETCH_ASSOC);
$this->_connectToDB();

$this->tcaseMgr=new testcase($this->dbObj);
$this->tprojectMgr=new testproject($this->dbObj);
$this->tplanMgr = new testplan($this->dbObj);
$this->tplanMetricsMgr = new tlTestPlanMetrics($this->dbObj);

$this->reqSpecMgr=new requirement_spec_mgr($this->dbObj);
$this->reqMgr=new requirement_mgr($this->dbObj);

$this->tables = $this->tcaseMgr->getDBTables();


$resultsCfg = config_get('results');
foreach($resultsCfg['status_label_for_exec_ui'] as $key => $label )
{
$this->statusCode[$key]=$resultsCfg['status_code'][$key];
}

if( isset($this->statusCode['not_run']) )
{
unset($this->statusCode['not_run']);
}
$this->codeStatus=array_flip($this->statusCode);

$this->initMethodYellowPages();
$this->methods += $callbacks;

$this->IXR_Server($this->methods);
}
fman
Member of TestLink Community
 
Posts: 3010
Joined: Tue Nov 15, 2005 7:19 am

Re: [SOLVED] write custom result status using api

Postby redpiyo » Wed Aug 28, 2013 9:45 am

I have edited the file xmlrpc.class.php in the directory testlink/lib/api/xmlrpc/v1 and added the following lines at the beginning of the function check_status:

if (($this->args[self::$statusParamName]) == 't')
$this->args[self::$statusParamName] = 'f';


I also apply this line when i am using custom test result, but for a different purpose, e.g. i have a test_error = 't' and i am assigning it to be failed = 'f' but from the Testlink java api, i am still not getting any test case status with fail.
redpiyo
Advanced user
 
Posts: 17
Joined: Sat Sep 15, 2012 10:08 am


Return to XML-RPC API



Who is online

Users browsing this forum: No registered users and 2 guests