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

TestRail API (get_tests) : Filtering list of tests for a test run


Hi !

I have test runs that have lots (thousands) of tests associated with. How can I filter the results of get_tests so that I only get the tests that are associated with test cases of type_id = Automated ?

The only filtering that I find on the get_tests is :status_id.



Hi @hockeymtl,

Thanks for your posting. get_tests only supports the status as server-side filter but you can read the full list and then filter on the client side. The response includes the type_id attribute you can filter on.



No limit on the number of elements that can be returned ?

Also, performance wise I doubt this is a good solution. I will have to return thousand of tests only to have the few ones (5-10) that have type_id set to automated.

Well, if it’s the only way to achieve this for now, I will do with it anyway.

Thanks for your quick answer, good support.


Thanks for your reply. get_tests will currently return the full test run. If you are interested in the cases instead of the tests in a specific run, you can also use get_cases instead and this has a type_id filter (+ others):



How do I find type_id for my test cases. Is type_id same as Type field dropdown values such as ‘Functional’, ‘Smoke & Sanity’ etc?


Case Types are Int… I believe these are the Standard Types and would assume that they are the same for any install (Hosted or self-hosted):