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

How to resolve com.test.APIException: TestRail API returned HTTP 403("This operation is not allowed. The test run belongs to a test plan and cannot be edited independently.")


#1

I am using add_results for uploading test results for my test run. I created a new test plan and then created a test run inside it. During upload of my test results it throws error:
com.test.APIException: TestRail API returned HTTP 403(“This operation is not allowed. The test run belongs to a test plan and cannot be edited independently.”)
But all the test results get uploaded properly.

Can any one please help me to resolve this error.
Thanks,
Mansi


#2

Hi Mansi,

Thanks for your posting. This message means that your code tries to update a test run (not results) which is part of a test plan. Runs in plans can only be modified via the update_plan_entry API method and update_run is only for standalone runs. Could you check if you call update_run as part of your code, maybe to change the case selection?

Note that this doesn’t affect the result adding via add_results and this would be independent of this and it seems that the result adding goes through in your case.

Cheers,
Tobias


#3

Thanks Tobias…

  1. Can I use update_plan_entry API for both test runs in and out of the test plan?
  2. If yes, can you please share a code snippet to use it.

Thanks,
Mansi


#4

Thanks alot Tobias, the issue is resolved :slight_smile:


#5

That’s great to hear, Mansi :slight_smile: update_plan_entry would only be for runs in plans but you can use update_run for standalone runs.

Cheers,
Tobias