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

Updating the test result using custom fields


We have a requirement where we are migrating the test cases from ALM to test rail.
Out automation scripts are already using the test_id of ALM so we want to keep the same test_id in test_rail and When using test rail APIs, we are planning to use those test ids which are migrated from ALM

I see there are two APIs to update the test results .

Both of the above APIs work when the test id is generated by test rail while creating the a new test case but we want to use the custom test id field for updating the test result.

Which API we can use for the above purpose, we want to make sure we use the existing test id for updating the test result (existing meaning the test id got from ALM Not the one generated by test rail).

Thanks for help and support.


Hi Vishal,

IMHO there is no direct way to do so.
Probably a new endpoint would help, but they are not implemented frequently.

First challenge: You would need to place an external id on case level as a custom field. But there is no way to ensure uniqueness on it. Perhaps a problem.

But anyway: The test you want to add (I guess not update) results to, is part of a run (or plan entry) which is linked to a suite (if you use multiple suites, if not, you can skip this).
Now you can get the case by using your new custom field (external ALM test_id). But you can’t use your custom field as a filter at get_cases. Therefore you would need to read a lot of cases to filter for your ALM Test_id.

It is possible to do so, but I wouldn’t.

Of course you have the best requirements to do so, but when do you plan to finish your migration? By creating new cases in TestRail, you don’t have a Test_id in ALM anymorel.

Just my personal ideas


Hi Karsten,

Thanks for your reply.

We have already added the ALM test id as custom field on case level and since they were unique in ALM when migrating we are making sure they remain unique in test rail as well.

Can you please let me know what endpoint, I can use so that I can get the case details using new custom field (external ALM test_id) and probably I can get test rail case id and use that whie adding test result, I am thinking of following approach -

  1. Get test rail case id from get_cases api using only external ALM test_id. ( which end point to use here ?)
  2. Use this case id to update the results in each run using add_result_for_case.

Looking for a probable solution if not a new endpoint possible at this time.

We have already started a migration and looking for this solution so that we are not blocked and we are trying to finish this by this year end.

For the cases created newly, I understand we will not have the external ALM test_id and hence for new cases the approach is straightforward for us to use case id while updating the test result.



just to make sure, I’m not part of the Testrail Team. I’m just a (former) user with experiences in migrating cases - especially from HP/Microfocus ALM.

Although ones they might be unique, every user with the needed privileges to edit cases can set/change a value, the system doesn’t check for uniqueness. Probably you try to prevent this with a UI script, but finally it’s not safe. Therefore I don’t expect to get a new endpoint for it. And even if, I don’t expect it on top of the feature list…

As already mentioned before, there is as far as I know NO endpoint to get cases by providing a custom field. The list of available fields for the request is available at the doc for get_cases. Using custom fields for it, is requested since some time already…
A working, but dirty workaround might be to place your external id in the title and use the field filter to fetch the right case(s).

I would fetch all cases once for a run/suite and search on a local list to get the case_id and then call add_result_for_case to ADD a result.

If you wanna stay with ‘your solution’ you need to invest something.

At least just my opinion. Probably there a re other forum members with better ideas… :grinning:

Good luck.


We can’t think of anything better than the workaround provided by @kwirth for the time being. TestRail auto assigns the ids at the database level and there’s no way to control that.

Having said that, we do have an open FR to allow custom fields to be used as request filters for get_cases API endpoint and I’ve added your vote to the same.

Just let me know if you have any further concerns!


Thank you @shanu.mandot and @kwirth for your reply.