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

How to update results for test cases inside a test plan?

Probably this is hidden in the documentation somewhere but I am unable to find it.

I have got a test plan created inside which I have got multiple test runs (About 20 testruns). I would have to go and update the status for the test cases present inside the test runs. Is there any direct API to do this ?

I may not know which specific test run the test case might belong to (As we update the manual and automation results in the same test plan). So rather than looping through all the test runs, is there a easy way to update the test case by passing the test_plan_id and the case_id?

I think there is no easy way to do so. At least there is noch endpoint for it.

IMHO there is one big problem with your request: TestRail ensures there is only one instance of your case (a test) in a test run. But with your probable 20 test runs, there might be more than than one test related to your case within the test plan (alhough you might not plan to do so, TestRail isn’t aware of your plan).
How should TestRail know where to add a result to: To the first instance, all instances or should it fail with more than one available instances?

Right now, I don’t have a better idea than to loop. :slightly_frowning_face:


Hi @Shar,

Thanks for the post! As @kwirth pointed out, you would need to iterate through your test runs within your test plan in order to add test results. Each test in TestRail is associated with test run in TestRail and a test case in your project. A test plan in TestRail is simply a collection of test runs, so a plan itself does not have a direct association with a test.

That said, each test case ID in TestRail is unique and does not change with each test run. So, if you have your test case IDs, you can add your test results to each test run using the add_results_for_cases endpoint, which would only require you to know the test case IDs and corresponding test run IDs.

I hope this is helpful,