Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.
 

Importing test cases from TestLink


#1

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


#2

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

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) > 0”>

<xsl:for-each select=“testsuite”>

<xsl:value-of select="@name" />
<xsl:if test=“count(testcase) > 0”>

<xsl:for-each select=“testcase”>
<xsl:call-template name=“testcase” />
</xsl:for-each>

</xsl:if>
<xsl:call-template name=“sections” />

</xsl:for-each>

</xsl:if>
</xsl:template>
<xsl:template name=“testcase”>

<xsl:value-of select="@name" />




<xsl:value-of select=“summary” />
<xsl:value-of select=“steps” />
<xsl:value-of select=“expectedresults” />

</xsl:template>
</xsl:stylesheet>

transform.pl
while(<>)
{
# bulleted lists
s/

  • /\n-/g;
    s/</li>//g;
    # kill all html
    s/<\/?[a-z]+( .*?)?>//g;
    print;
    

    }


  • #4

    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

    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 :

    <![CDATA[

    Ouvrir l'application

    ]]> <![CDATA[

    Arrivée sur la page de connexion. Les champs sont vides.

    ]]> <![CDATA[

    Saisir une chaine dans le champ Identifiant

    ]]> <![CDATA[

    La chaine est saisie dans le champ identifiant.

    ]]> <![CDATA[

    Saisir une chaine dans le champ Mot de passe

    ]]> <![CDATA[

    Une chaine est saisie dans le champ mot de passe

    ]]>

    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

    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/testrail-1-3-released/1491/

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

    Thanks,
    Dennis


    #7

    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 :slight_smile:


    #8

    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


    #9

    Hi Dennis,

    As you can !

    Thanks by advance.


    #10

    Hello Agehl,

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

    Thanks,
    Dennis


    #11

    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-migrate/page/testlink2testrail/ 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

    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


    #13

    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-migrate/page/testlink2testrail/

    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


    #14

    Hello Dennis.

    Thanks, I will try :slight_smile:


    #15

    It works fine :slight_smile: All our projects have been migrated :slight_smile:

    Thanks a lot Dennis.


    #16

    Perfect, thanks for the confirmation, that’s great to hear. :slight_smile:

    Regards,
    Dennis


    #17

    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

    Thanks for the confirmation Dave, I appreciate it!

    Regards,
    Dennis


    #19

    I have a new trial version and am trying to import cases from TestLink, but get the following error:
    “No >section< tag found in >sections<.” (Note: xml delimiters reversed to keep this site from removing them)

    I was able to successfully import the examples/simple/testsuites.xml file, so I believe I have the steps correct.

    There is no section or sections XML tags in my input file.


    #20

    Hey Daryl,

    Thank you for the post. Are you using our documentation and migration script to export your test cases out of TestLink located here:

    http://docs.gurock.com/testrail-admin/migration-testlink

    If so and you are still having this problem, could you please send a message to contact@gurock.com along with the XML file you are attempting to import into TestRail. We would be happy to take a look at this for you.