Hi all,
Using testlink 1.7.2, made the following changes:
1. custom_string.txt
// Add new print option
$TLS_opt_show_tc_reqts = "Show Test Case Requirements";
$TLS_reqts = "Requirement";
2. selectData.php
// Add new option - reqts
$arrCheckboxes = array(
array( 'value' => 'header', 'description' => lang_get('opt_show_doc_header'), 'checked' => 'n'),
array( 'value' => 'toc', 'description' => lang_get('opt_show_toc'), 'checked' => 'n'),
array( 'value' => 'summary', 'description' => lang_get('opt_show_tc_summary'), 'checked' => 'n'),
// New option
array( 'value' => 'reqts', 'description' => lang_get('opt_show_tc_reqts'), 'checked' => 'n'),
array( 'value' => 'body', 'description' => lang_get('opt_show_tc_body'), 'checked' => 'n'),
array( 'value' => 'author', 'description' => lang_get('opt_show_tc_author'), 'checked' => 'n'),
array( 'value' => 'passfail', 'description' => lang_get('opt_show_passfail'), 'checked' => 'n'),
);
3. printData.php
// Add reqts for print test cases
$printingOptions = array ( 'toc' => 0,'body' => 0,'summary' => 0,'reqts' =>0, 'header' => 0, 'passfail' => 0, 'author' => 0);
4. print.inc.php
function renderTestCaseForPrinting(...)
{
<clipped>
if ($printingOptions['body'] || $printingOptions['summary'])
{
if ($tcInfo)
{
if ($printingOptions['summary'])
{
<clipped>
$query = "SELECT requirements.id,requirements.title
FROM requirements, req_coverage
WHERE req_coverage.testcase_id ='".($id)."'
AND req_coverage.req_id = requirements.id";
$result = mysql_query($query)
or die ("Query '$query' failed with error message: \"" . mysql_error () . '"');
if (mysql_num_rows($result) < 1) {
$testcasetitle = "No associated requirements";
} else {
while ($row = mysql_fetch_assoc($result)) {
$testcasetitle = $row['title'];
//$code .= "<tr><td colspan=\"2\"><u>".
// lang_get("reqts")."</u>: " . $testcasetitle ."</td></tr>";
$code .= "<tr><td colspan=\"2\"><u>".
("Requirement")."</u>: " . $testcasetitle . "</td></tr>";
}
<clipped>
}
}
}
The problem is I'm not able to enable the "Print Options" - "Show Test Case Requirements" functionality. I had to place the above item (4) code, as you can see, under $printingOptions['summary'] block in-order to have it work. I've tried to have it in its own (if statement) block but with no success. Where would I need to place it? What am I missing?
Recommendations appreciated in advance.
Enable new print option
Re: Enable new print option
Your code is fine, the documentation in the selectData.php is in-complete.klee wrote:Hi all,
The problem is I'm not able to enable the "Print Options" - "Show Test Case Requirements" functionality. I had to place the above item (4) code, as you can see, under $printingOptions['summary'] block in-order to have it work. I've tried to have it in its own (if statement) block but with no success. Where would I need to place it? What am I missing?
Recommendations appreciated in advance.
You also need to edit \gui\javascript\testlink_libarary.js and add your option there:
Code: Select all
function tree_getPrintPreferences()
{
var params = [];
var fields = ['header','summary','toc','body','passfail',
'tcspec_refresh_on_action','author','showbugs'];
I have a modified print.inc.php that I will share here when I get done with it, it shows execution history, build history, pass/fail, notes, author information, editor information, and soon bug info.
When I finish it, I will post it.
Drak
Re: Enable new print option
Hello Drak,Drakoss wrote: I have a modified print.inc.php that I will share here when I get done with it, it shows execution history, build history, pass/fail, notes, author information, editor information, and soon bug info.
When I finish it, I will post it.
Drak
your contribution is welcome. I recommend to add your files via attachment of our tracker. Thanks,
Martin
Re: Enable new print option
I will certainly do so. I ended up modifying more than just print.inc so the tracker would probably be the place to do it. I am afraid my coding and commenting doesn't meet your standards. I will upload when I am finished and if you have any questions you can communicate them via the tracker or email.havlatm wrote:
Hello Drak,
your contribution is welcome. I recommend to add your files via attachment of our tracker. Thanks,
Martin
BTW this is a great product, we haven't officially started using it where I work, but I did demo it to my managers and they are on board with it. Just have to work out a few details before we go live. Unfortunately policy forbids me from posting in your company forum.
Drak
Re: Enable new print option
Done deal,havlatm wrote:
Hello Drak,
your contribution is welcome. I recommend to add your files via attachment of our tracker. Thanks,
Martin
For those of you who want to see this or implement on 1.7.4 the files and instructions are under this case:
http://www.testlink.org/mantis/view.php?id=1678