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

Custom IDs in API


#1

My team is currently evaluating testrail in order to see if we can use it instead of testlink.
In order to do so we need to transfer testlink IDs into Testrail.
I have searched the internet and found that there is no way to change the test cases IDs.
Therefore, I’ve added a custom field of ‘testlink_id’ to the testcases and updated them through a script I’ve found online by one of the developers.
My question is, since this id is also unique, is it possible to use the API (e.g: add_result_for_case) using this custom fieldname as an identifier instead of using the builtin ‘case_id’?

We are also currently using a site (on the cloud) as the server but we are planning on moving it to a local server - is it possible that the IDs will remain the same? (or will it start from 0 again)


#2

Hi,
Hope this link will help you http://docs.gurock.com/testrail-userguide/howto-fields


#3

Hi Eva,

Thanks for your posting. Yes, you can also use a custom field or custom IDs to build your case selection for a test run/plan but this requires an intermediate step. add_result_for_case requires the TestRail ID (the numeric part of C###) but you can map your previous IDs (or any other field) by looking at the response of get_cases:

http://docs.gurock.com/testrail-api2/reference-cases

So, by looking at the custom_testlink_id field, you can find out the corresponding TestRail ID and then use this ID to submit test results via add_result_for_case. The same is true to build your case selection (if you don’t want to include all cases in a run). In the long run, we usually recommend migrating away from custom IDs after migrating from another tool because there’s usually no benefit associated with maintaining the old IDs and using TestRail’s own IDs would make it much simpler to add new cases over time.

Regarding the migration from TR Cloud to Server: you can download a full database backup on Administration > Subscription and restore this locally and you would end up with an exact copy of your TestRail Cloud instance (so the IDs would be the same). You can also start with a fresh/empty installation if you prefer this alternatively.

Cheers,
Tobias