1

Topic: Importing test cases from TestLink

Has anyone converted test cases from TestLink XML to the TestRail format?

2

Re: Importing test cases from TestLink

Already answered this via email, but to let other readers know as well:

We currently do not have a conversion script available but are looking into providing tools to convert and import other formats directly into TestRail.

Regards,
Tobias

3

Re: Importing test cases from TestLink

I created an XSLT Transform and a quick perl script that works fairly well. You can run them from bash as follows:

    xsltproc tl2tr.xslt all_testsuites.xml  | tr "\n" " " | ./transform.pl| xmllint --format - > import.xml

tl2tr.xslt

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <xsl:for-each select="testsuite">
    <xsl:call-template name="sections" />
  </xsl:for-each>
</xsl:template>
<xsl:template name="sections">
  <xsl:if test="count(testsuite) &gt; 0">
  <sections>
    <xsl:for-each select="testsuite">
      <section>
        <name><xsl:value-of select="@name" /></name>
        <xsl:if test="count(testcase) &gt; 0">
        <cases>
          <xsl:for-each select="testcase">
            <xsl:call-template name="testcase" />
          </xsl:for-each>
        </cases>
        </xsl:if>
        <xsl:call-template name="sections" />
      </section>
    </xsl:for-each>
  </sections>
  </xsl:if>
</xsl:template>
<xsl:template name="testcase">
  <case>
    <title><xsl:value-of select="@name" /></title>
    <type></type>
    <priority></priority>
    <estimate></estimate>
    <milestone></milestone>
    <preconds><xsl:value-of select="summary" /></preconds>
    <steps><xsl:value-of select="steps" /></steps>
    <expected><xsl:value-of select="expectedresults" /></expected>
  </case>
</xsl:template>
</xsl:stylesheet>

transform.pl
while(<>)
{
    # bulleted lists
    s/&lt;li&gt;/\n-/g;
    s/&lt;\/li&gt;//g;

    # kill all html
    s/&lt;\/?[a-z]+( .*?)?&gt;//g;
    print;
}

4

Re: Importing test cases from TestLink

Hi asm,

Thanks a lot for sharing your scripts, we really appreciate it. I will make sure to try your scripts today (and recommend them to other customers who want to migrate from TestLink). Thanks again!

Regards,
Tobias

5

Re: Importing test cases from TestLink

Hi,

It seems that the new version of testlink (1.9.x) is not supported by your scripts. I think this is because they have changed their system of Steps (we can now create step one by one) so the XML export have changed.

Example of new XML :

<steps>
<step>
    <step_number><![CDATA[1]]></step_number>
    <actions><![CDATA[<p>Ouvrir l'application</p>]]></actions>
    <expectedresults><![CDATA[<p>Arriv&eacute;e sur la page de connexion. Les champs sont vides.</p>]]></expectedresults>
    <execution_type><![CDATA[1]]></execution_type>
</step>

<step>
    <step_number><![CDATA[2]]></step_number>
    <actions><![CDATA[<p>Saisir une chaine dans le champ Identifiant</p>]]></actions>
    <expectedresults><![CDATA[<p>La chaine est saisie dans le champ identifiant.</p>]]></expectedresults>
    <execution_type><![CDATA[1]]></execution_type>
</step>

<step>
    <step_number><![CDATA[3]]></step_number>
    <actions><![CDATA[<p>Saisir une chaine dans le champ Mot de passe</p>]]></actions>
    <expectedresults><![CDATA[<p>Une chaine est saisie dans le champ mot de passe</p>]]></expectedresults>
    <execution_type><![CDATA[1]]></execution_type>
</step>
</steps>

Have you plan to do something to adapt your scripts ?

Thanks by advance.

NB : this new testlink feature is good, it could be a good feature to Testrail wink

6

Re: Importing test cases from TestLink

Hello Agehl,

We haven't had a chance to look into the new format yet so thanks for posting this. We will look into this so we can update the conversion script soon. Let me know in case this is a critical issue for you.

By the way, TestRail already supports separate test case steps but it's not the default configuration in TestRail. You can learn more about this feature on our blog here (see the section Test Steps):

http://blog.gurock.com/postings/testrai … ased/1491/

I'm also happy to explain how to configure this if you are interested in trying this.

Thanks,
Dennis

Dennis Gurock,
Director & Co-Founder
Gurock Software

7

Re: Importing test cases from TestLink

Hello Dennis,

It's not very critical, I just wanted to know if you support these script in the case of we change testlink to testrail.

I try separate testcase steps and it's exactly what I want smile

8

Re: Importing test cases from TestLink

Hello Agehl,

Thanks for the update. Please see below for the instructions on how to configure separate test steps and let me know in case/when you need the script for the migration.

-----------------
Please use the following steps to configure separate test steps in TestRail:

1. Select Administration > Custom Fields
2. Under the Case Field table, click the Add Field button
3. For the Label enter 'Steps', for the System Name enter
'steps_separated' and select 'Steps' as the Type
4. Before you save the new field, click the Add Projects & Options link
in the Projects table below. In the dialog, just click OK to use the
defaults and to assign the custom field to all projects
5. Now click the Add Field button to submit the field

Now, in addition to the test steps for the cases, you can also configure
TestRail to display the steps in the Add Test Result dialog. This will
allow you to select results for separate steps. To display the test
steps in the dialog, just add a custom fields to the Test Results:

1. Under the Test Field table, click the Add Field button
2. For the Label enter 'Step Results', for the System Name enter
'step_results' and select 'Step Results' as the type
3. Add the field to all projects again
4. Click the Add Field button to submit the field

You might also want to delete or disable the built-in fields (to disable
a field, edit it and simply remove the entry from the Projects table;
this will remove the fields from all projects without deleting the
entered data so you can restore the fields later if needed). We usually
add a Description text fields to cases and disable the Preconditions,
Steps and Expected results fields when configuring separate steps, but
you can configure this as needed. I recommend keeping the built-in steps
text field in order to migrate your existing data in case you have any.
-----------------

Thanks,
Dennis

Dennis Gurock,
Director & Co-Founder
Gurock Software

9

Re: Importing test cases from TestLink

Hi Dennis,

As you can !

Thanks by advance.

10

Re: Importing test cases from TestLink

Hello Agehl,

Sure, we will look into this early next week and I will update the posting then or email you.

Thanks,
Dennis

Dennis Gurock,
Director & Co-Founder
Gurock Software

11

Re: Importing test cases from TestLink

Hi Dennis...

I am also currently using TestLink 1.9.2 and looking to switch to TestRail, but can only do so once the migration script has been updated to work with the above-mentioned TestLink version.

The script at http://code.gurock.com/p/testrail-migra … 2testrail/ does not work properly - test cases lose their notes, their summaries end up as pre-requisites, and the steps and expected results disappear completely.

If you could please post your updated migration technique for everyone to see, that'd be great!

Thanks,

Dave.

12

Re: Importing test cases from TestLink

Hi Dave,

we are working on the updated script and we should have it ready in a day or two. I will make sure to notify you here when the updated script is available.

Thanks,
Dennis

Dennis Gurock,
Director & Co-Founder
Gurock Software

13

Re: Importing test cases from TestLink

Hello agehl and Dave,

We've now built a conversion script for TestLink 1.9. You can download the updated version from our website here:

http://code.gurock.com/p/testrail-migra … 2testrail/

Please note that you need to configure TestRail for separate test steps, as TestLink 1.9 is also using this format now:

http://docs.gurock.com/testrail-faq/config-steps

Just let me know in case you have any questions or issues with this.

Thanks,
Dennis

Dennis Gurock,
Director & Co-Founder
Gurock Software

14

Re: Importing test cases from TestLink

Hello Dennis.

Thanks, I will try smile

15

Re: Importing test cases from TestLink

It works fine smile All our projects have been migrated smile

Thanks a lot Dennis.

16

Re: Importing test cases from TestLink

Perfect, thanks for the confirmation, that's great to hear. smile

Regards,
Dennis

Dennis Gurock,
Director & Co-Founder
Gurock Software

17

Re: Importing test cases from TestLink

Hi Dennis...

Sorry it took me so long to reply, but this just to confirm that the updated migration script worked for me too. Thanks for updating it so swiftly.

Kind regards,

Dave.

18

Re: Importing test cases from TestLink

Thanks for the confirmation Dave, I appreciate it!

Regards,
Dennis

Dennis Gurock,
Director & Co-Founder
Gurock Software