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

Getting total test case count via API?

What is the best way to get the total test case count across all projects via API?
Can this also be done on a per-project basis via API?

Hi @sprakash,

Thanks for reaching out! The TestRail API is per-project based. You can use the get_cases method listed here and this method would pull all the test cases in your project. You can then push the IDs for example into an array and count the length of items in your array for your cases count. More information on the syntax and filters available are in the aforementioned article. I hope this helps.


I was hoping there was a more efficient way of doing this. Our projects are currently small, but I would expect there to be significant memory requirements for thousands, 10s of thousands of test cases.
Could you please put in a Feature Request to

  1. Return test case count in get_project/get_projects
  2. Return test case count in get_suite/get_suites
  3. OR create a new endpoint to return the necessary data