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

TestRail API: get results for a case



How can I get all results for a case using API v2 like in Test Results tab on case review page?
I find two methods which return test result (get_result and get_result_for_case) but it return results only for one test run.



Hello Alex,

Thanks for your posting. There’s currently no API method for this unfortunately. If you have access to the database (i.e., if you use a self-hosted installation of TestRail), you could look into querying TestRail’s database for this and I’m happy to provide the necessary details for this.

Please note that we only support accessing the database directly for read-only queries. Write actions are only supported via the API.



Hello Tobias,

Thanks for your answer. It would be perfect if you explain me how I can do this using TestRail’s database.
And a have some additional questions:

  1. In this way can I get full information about test case results history (all fields included custom for each result) ?
  2. Can I realize this feature as a custom API method?



Hello Alex,

Thanks for your reply and my apologies for the delayed response.

  1. Yes, this would be possible. You would need to execute custom SQL queries (read-only) against the database. The most relevant table for this would be ‘test_changes’ which contains one entry for each test result or comment. To get all test results for a specific test case, you could use something like this:
  1. Custom API methods are not supported and you would need to access the database directly.

I hope this helps and please let me know in case you have any further questions.



Thank you. I think it is best solution for me. I will try implement this.


You are welcome. Sounds good!




Are there any updates on when this feature might be implemented? It’s been 3 years since this was posted, it would be awesome to find out where this stands.


Hi Celestine,

Thank you for your post and checking on this. We do not have an ETA for when this will be or if it will be added in a future release. I would be happy to add a comment to the feature request on your behalf though.


I’m also looking for a way to get historical results for a case. It would be very useful for categorizing automated tests as frequently failing to find flappers in our testsuites. I would think there’d be a cases category api call to get all test results, but equally valuable would be totals for each status in testrail for the case. Querying the db is ugly for something like this.


Is it possible to get information about the DB schema so that I can do higher performance retrievals of test results. The current API which retrieves results given a test ID is taking a huge amount of time. It would be advantageous to do a grab of all current results for a project and/or milestone.