Better Copy/Paste When Editing Test Steps in TestLink

My current biggest peeve with TestLink is how hard TestLink makes it to copy text out of test steps when editing a test case. Both when viewing a case and when editing test case steps via the Test Specification interface, clicking on the text of a test step causes you to start editing the text in that step.

I find this behavior very off-putting. I constantly find myself trying to copy in these views, either to copy repetitive actions from a previous step, or to do a dry-run executing a test case. I finally got mad enough today to spend the time figuring out how to change this behavior.

Update 2012-05-08: There is a usable-with-the-patch-command patch available that incorporates all of these changes and more. See the README at the base of the github repo for more details on what’s in that patch.

There are two Smarty templates that control the layout of these views, both of which live in gui/templates/testcases/. inc_steps.tpl controls the layout when viewing a test case (but not editing steps), and tcStepEdit.tpl controls the layout when editing steps.

After applying these patches, you can copy text out of the Step Action and Expected Results columns. To edit the row as before the patch, click on the row counter (the first cell in the row).

These patches are against TestLink 1.9.3

--- inc_steps.tpl.dist  2011-08-22 21:08:21.000000000 -0500
+++ inc_steps.tpl       2011-09-22 10:08:55.000000000 -0500
@@ -53,10 +53,10 @@
                        {include file="error_icon.tpl" field="step_number"}
-                       </span>{$step_info.step_number}
+                       </span><div {if $edit_enabled} style="cursor:pointer;" onclick="launchEditStep({$})" {/if}>{$step_info.step_number}</div>
-               <td {if $edit_enabled} style="cursor:pointer;" onclick="launchEditStep({$})" {/if}>{$step_info.actions}</td>
-               <td {if $edit_enabled} style="cursor:pointer;" onclick="launchEditStep({$})" {/if}>{$step_info.expected_results}</td>
+               <td>{$step_info.actions}</td>
+               <td>{$step_info.expected_results}</td>
                {if $session['testprojectOptions']->automationEnabled}
                <td {if $edit_enabled} style="cursor:pointer;" onclick="launchEditStep({$})" {/if}>{$gui->execution_types[$step_info.execution_type]}</td>
--- tcStepEdit.tpl.dist 2011-09-22 10:27:23.000000000 -0500
+++ tcStepEdit.tpl      2011-09-22 10:39:55.000000000 -0500
@@ -211,8 +211,8 @@
         <td style="text-align:left;"><a href="{$hrefEditStep}{$}">{$step_info.step_number}</a></td>
-               <td ><a href="{$hrefEditStep}{$}">{$step_info.actions}</a></td>
-               <td ><a href="{$hrefEditStep}{$}">{$step_info.expected_results}</a></td>
+               <td >{$step_info.actions}</td>
+               <td >{$step_info.expected_results}</td>
         {if $session['testprojectOptions']->automationEnabled}
                  <td><a href="{$hrefEditStep}{$}">{$gui->execution_types[$step_info.execution_type]}</a></td>

I’ve been writing test cases with this change in place all morning and it is much, much nicer than the default behavior

3 thoughts on “Better Copy/Paste When Editing Test Steps in TestLink

  1. Pingback: » Setting Default Font in TestLink Great Hat…

  2. Very helpful! The default behaviour is really annoying.

    Unfortunatly I didn’t find out how to apply the patch (without touching the original file). I tried to put a file with this content into the folder and named it “tcStepEdit.tpl.patch” or “tcStepEdit.patch”, but it did not work – searching the net wasn’t that helpful. Maybe it’s soeasy that nobody has the same problem as me.

    Anyway changing the original template files worked for me.

    Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *