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

API Request: get_results_for_case that doesn't require a Run


#1

Would it be possible to get a get_results_for_case api call that doesn’t require a run?

We’d like to be able to compare historical executions for an individual case, and right now there is no way to do that efficiently.

Basically I’d like the API equivalent of going to a Case in the UI, selecting “Test Results”, then selecting “Results & Comments”.

Alternatively, is there any way to determine what runs a single case has been included in?

Thanks!


#2

Hello Logan,

Thanks for your posting. It’s currently not supported to implement this with the API (efficiently). This has been requested before by other customers as well and we already have this on our todo list for the API (it’s one of the most often requested methods).

We recommend accessing the database directly for this in the meantime (which is supported for read-only queries and a local TestRail installation) and this would involve querying the cases, tests and test_changes database. I’m happy to provide additional details if accessing the database would be an option.

Regards,
Tobias


#3

We were hoping to avoid querying the db directly, but at this point it seems we have enough use cases that require it.

Can you provide some tips on the best query for finding previous results for a given case? Our starting point is actually a failing Test ID.

Thanks!


#4

Hello Logan,

Thanks for your reply. We will make sure to prepare a small example for this and get back to you then (via email).

Regards,
Tobias


#5

Would you send me this example? I am currently using Python to access the API. thank you


#6

Hello @ez.b,

Thanks for your posting. There’s currently no dedicated API methods for this use case and we can recommend using the exports in this case instead. If you are interested in all results for a particular case in a milestone (which includes multiple runs/plans etc.), you can simply download the XML or CSV exports to get a quick overview of all results for a case.

Cheers,
Tobias


#7

Hi,
I am looking for the API call which can be used to fetch multiple test cases from multiple test suites instead of one test suites. Like using below snippet with get_Suites. Need example with multiple test suite ids as input
client = APIClient(‘http:///testrail/’)
client.user = ‘…’
client.password = ‘…’
case = client.send_get(‘get_case/1’)
pprint(case)