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

Migrating testlink ID into Testrail


#1

Hi

I just installed Testrail to see if we can migrate our current testlink project.

Migrating data seems to be working so far, with our test suites and test cases.

The only issue is that we can’t see in any part of the imported data the testlink ID of the test cases. We looked into the xml file generated from the migration script and we see that there’s a “internalid” attribute on the testcase nodes, which is the testlink ID, but it seems that it’s not imported into Testrail.

Is there any way we can keep those testlink ID associated to the testcases imported on Testrail?

Thanks in advance


#2

Hello Esteban,

Thanks for your posting. TestRail has its own ID “namespace” and TestLink’s IDs are not imported with the conversion script. It should be possible to keep the TestLink ID as a custom field in TestRail but this would require customizing the conversion script. I’m happy to provide the details if you interested in this.

Regards,
Tobias


#3

Yes, it would be great if you can give me details on how to add TestLink ID as a custom field on TestTrail.

Regards


#4

Hello Esteban,

Sure, I’m happy to help. The general idea would be to add a new custom field for the TestLink IDs in TestRail under Administration > Customizations > Test Case Fields (of type String). You would then need to modify the TestLink conversion script to output the following XML structure for each test case:

.. TESTLINK-ID ..

The element in the XML file for the custom field (in this case “”) would need to match the system name you enter for the custom field in TestRail.

If you then import the XML file in TestRail, you should see the migrated TestLink IDs in the ID custom field. You can also add the custom field to the test case tables and this looks as follows (and even hide the internal test case IDs if you prefer this):

I hope this helps and please let me know in case you have any further questions.

Regards,
Tobias


#5

We modified the 1.9 testlink conversion script to import the testlink id’s.

In 1.9, the testlink id’s are in an element in each test case.

  1. Add a custom field named ‘testlink_id’

  2. Add this code to the write_case function in the conversion script:

[code]// FIND THIS LINE IN THE write_case FUNCTION:
xml_write_opening_tag($handle, ‘custom’);

// ADD THIS CODE BEFORE THE PRECONDITIONS
// write testlink id as custom field
$externalid = NULL;
if (isset($case->externalid)) {
$externalid = trim($case->externalid);
}
if (isset($externalid)) {
// CHANGE THIS HOWEVER YOU WANT
$valuetoimport = ‘CT-’.$externalid;
xml_write_tag($handle, ‘testlink_id’, $valuetoimport);
}[/code]


#6

Hello Chris,

Thanks a lot for sharing this, that’s really appreciated. I’ve put your code into a code block so that it’s a bit easier to read (in case you are wondering).

Thanks again,
Tobias