Adding custom reports to the Results page

LATEST Official version.
Questions and discussions - NO ISSUES
FOR ISSUES => http://mantis.testlink.org

Moderators: Amaradana, TurboPT, TL Developers

Post Reply
jfs
TestLink user
Posts: 2
Joined: Fri Nov 19, 2010 8:10 pm

Adding custom reports to the Results page

Post by jfs »

Hi, all. I did some searching the last few days and was not able to find any clear procedures for creating a new report in the Results page. The user manual notes the .php and .tpl files and that you need to add a link in the strings.txt file but the exact syntax (such as the $TLS_xxxxxxx variables and how they relate to the name you gave it in custom_config.inc.php) was not covered. After much frustration and some detailed searching through source, I pulled together a procedure for creating a new custom report. Hopefully, this will save someone all the painful and fruitless searching I had to go through before finding the answers. ;)

For example, let's say you wanted to make a custom QA report and name it "QA Custom Report 1." This report is mostly based on the "Test Cases with Execution Details" built-in report. You would do the following:
  1. Copy testlink/lib/results/testCasesWithCF.php to testlink/lib/results/qa1.php and modify the qa1.php file to suit your needs.
  2. Copy testlink/gui/templates/results/testCasesWithCF.tpl to testlink/gui/templates/results/qa1.tpl
  3. Edit your custom_config.inc.php and add a link to your qa1 report like so:
    // If you create your OWN reports and add something like this:
    //
    // ------------------------------------------------------------
    $tlCfg->reports_list['qa_custom_1'] = array(
    'title' => 'link_qa_custom_1',
    'url' => 'lib/results/qa1.php',
    'enabled' => 'all',
    'format' => 'format_html,format_xls'
    );
    // -----------------------------------------------------------
    // Your reports WILL BE ON TOP OF standard TL Reports on left frame
    //
    //
  4. Edit testlink/locale/en_GB/strings.txt and add a string entry for your report name like so:
    // ----- cfg/reports.cfg.php -----
    $TLS_link_qa_custom_1 = "QA Custom Report 1";
  5. Edit any other language's strings.txt files and add your localizations as needed.
  6. Restart your web server if needed.
That's it! Your new report should show up at the top of the list on the Results page. Now you can edit/tweak things to support your desired report data and formatting.

Enjoy!
John
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: Adding custom reports to the Results page

Post by fman »

>> Hopefully, this will save someone all the painful and fruitless
thanks for giving us, a good motivation to continue to develop this tool.
We need more users like you supporting us in this way.
Post Reply