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

Fetch test case by id when using python api


#1

HI guys
I am currently using python with the test rail API, to do the automation testing.
when i use get_case method. it needs the test case id.
so firstly where can I find the testcase id for each case.?
Thank you very much


#2

You can make a get_cases call to get all of the cases and parse through them to find the one you’re looking for.


#3

Hi!

get_cases also supports various filters which are useful to limit the result (e.g. to test cases added after a certain date). I’m also happy to suggest additional implementations if you could provide a few more details on what you are trying to accomplish. One common approach for example is to store the case IDs together with your automated tests as part of your code (the case ID never changes) and you can then easily add test results via add_result_for_case:

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

Regards,
Tobias


#4

Hi guys
Thank you very much for your explanation.
problem solved. it is my mistake that I was putting the wrong method name. it suppose to be get_case


#5

Great to hear that the issue is now solved!

Regards,
Tobias


#6

yes, thank you
I have a question if I want to update a result for a test. what type of value should I put for the second argument for add_result method?
should I put a string like this? [ { ‘status_id’: result } ]


#7

It needs to be the ID of the test status, e.g.:

http://docs.gurock.com/testrail-api2/accessing