Showing posts with label trac. Show all posts
Showing posts with label trac. Show all posts

Sunday, April 1, 2012

trac: bulk update for ticket custom field

We wanted to update a custom field for group of tickets in trac, we have version 0.11.6, tried to look around, and found that there is no support for bulk change from the UI

I thought of doing this on the DB directly, I found that our trac  is using SQLite from the configuration file,

database = sqlite:db/trac.db

I downloaded SQLiteStudio, a tool for SQLite from http://sqlitestudio.one.pl/

opened the tool, created new Database from the file stated above in the configuration file, usually it will be in trac-projects folder, inside project folder\db

started building my query, it ended up like below

update ticket_custom
set value = 'Parked'
where name = 'internal_status' and ticket in (select t.id from ticket t
    INNER JOIN ticket_custom tc on tc.ticket = t.id
where version in ('Release1','Release2')
     and tc.name = 'internal_status'
     and tc.value <> 'Closed' and tc.value <> 'Parked')

executing the above query, I was able to bulk update for my custom field for a group of tickets

Monday, November 21, 2011

Testlink: Timeout Exception in reports after setting up integration with Bug tracking system

We are using testlink and already did setup for integration with bug tracking system that we are using, trac. While doing testing after this step we found out that some reports are not working and it is giving timeout exception

after digging into the code looking for why this is happening, I found out that there is some loop that is calling the bug tracking system for each bug attached to test case.

The function that is called to get the bug is called get_bugs_for_exec, found in exec.inc.php file

This function is not causing any problem when opening the test cases, it is listing the bugs and getting the bug data from bug tracking system without any problems

To workaround the error I am getting in the reports, I have created another function called get_bugs_for_exec_reports with the same implementation but instead of calling the bug interface to get bug details, I just commented this part and only displayed the bug number, this will be enough for the reports, then in reports files, I changed instead of calling get_bugs_for_exec, I am calling get_bugs_for_exec_reports

files where I have done this change

\lib\functions\results.class.php

\lib\results\resultsByStatus.php

\lib\results\resultsBugs.php

Function:

function get_bugs_for_exec_report(&$db,&$bug_interface,$execution_id)
{
    $tables['execution_bugs'] = DB_TABLE_PREFIX . 'execution_bugs';
    $tables['executions'] = DB_TABLE_PREFIX . 'executions';
    $tables['builds'] = DB_TABLE_PREFIX . 'builds';
   
    $bug_list=array();
    $sql = "SELECT execution_id,bug_id,builds.name AS build_name " .
        "FROM {$tables['execution_bugs']}, {$tables['executions']} executions, " .
        " {$tables['builds']} builds ".
        "WHERE execution_id={$execution_id} " .
        "AND   execution_id=executions.id " .
        "AND   executions.build_id=builds.id " .
        "ORDER BY builds.name,bug_id";
    $map = $db->get_recordset($sql);
   
    // BUGID 3440 - added is_object() check
    if( !is_null($map) && is_object($bug_interface))
    {     
        foreach($map as $elem)
        {
            $bug_list[$elem['bug_id']]['link_to_bts'] = $elem['bug_id'];#$bug_interface->buildViewBugLink($elem['bug_id'],GET_BUG_SUMMARY);
            $bug_list[$elem['bug_id']]['build_name'] = $elem['build_name'];
        }
    }   
    return($bug_list);
}

Thursday, November 3, 2011

trac - installing XMLRPC plugin required for testlink integration

In order for testlink to work with trac, we must install the xmrpc plugin for testlink
To install this plugin

1- Follow the download instructions download the plugin from http://trac-hacks.org/wiki/XmlRpcPlugin
2- Open the command line, go to python directory\scripts
3- Run the command

$ easy_install -Z -U /path/to/unpacked/download/version 

I used the path to the trunc folder inside the downloaded plugin

4- Search for trac.ini files and update with the below

[components] 
tracrpc.* = enabled 

5- Test the install by visiting http://server-name/trac/project-name/xmlrpc, you should see a wiki page with the protocol usage with trac

Thursday, October 27, 2011

Testlink–trac integration

We are using testlink for test case management, and using trac for bug tracking, we were looking for integration between the 2 tools.
I found out there is built in support for different bug tracking tool in testlink, all we need to do is just to enable this integration
The integration work like the following, you can link any execution of test case to one or more bugs, and when viewing these tese cases it will show the bug id, bug status, bug summary. Also when displaying reports, same bug information is displayed
To enable the integration:
1- Go to testlink directory, open the file
2- Look for the line:  $g_interface_bugs = 'NO';
3- Change to $g_interface_bugs = 'TRAC';
4- Save and close
To setup the integration with trac
1- Go to cfg folder
2- open the file trac.cfg.php
3- Update the setting with your trac url
define('BUG_TRACK_DB_HOST', 'http://hostURL/trac/');
4- update the mapping between testlink project and trac project
$g_interface_bugs_project_name_mapping = array(
    'testlink project name' => 'trac project name'
5- Save and close