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

Adding test results to new case gives "The test run is already completed." error


#1

Hi, i’m trying to use the api to create a new test run and add results from my automated testing to it.

To achieve this I create a new test run via “add_run” and specify:

  • suite_id
  • name
  • assignedto_id
  • include_all
  • case_ids

However when i then take that new test run and try to call “add_result” pass/fail for it i get the error message:
“error”: “This operation is not allowed. The test run is already completed.”

I think my issue may be that i am forgetting a step or creating my new test run incorrectly causing it to be created and automatically closed at the same time.


#2

Hi John,

Thanks for your posting. Please make sure you pass the correct IDs to add_result and this API function would expect the test ID (numeric part of the T### vs. case IDs with the format C###). If you have the case ID (and new run ID returned by add_run) instead, it’s simpler to call add_result_for_case instead:

http://docs.gurock.com/testrail-api2/reference-results#add_result_for_case

Cheers,
Tobias


#3

I switched to add_result_for_case and got it to work, thank you!


#4

Hi John,

That’s great to hear, thanks for the update!

Cheers,
Tobias