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

TestRail API to get all Test Cases for specific Test Run and Specific Section


#1

Dears,

I want to get all test cases under specific Test Run and specific Section which will also give all details like Test Cases Id, Summary Titile of test cases, Defects id, UserStory and Last Updated date for the test cases.

I an using this to get result but still, it is missing Test cases name, Defects and last update date.
index.php?/api/v2/get_results_for_run/229&session_id=4033

I searched everywhere but unable to get such specific API to get what I require.

Appreciate if you anyone can help on this.


#2

No Response…yet ??? Can anyone help me in this forum.


#3

You’ll need to use the get_case API to obtain this information. You can pass in the test_id obtained from the get_results_for_run api call into get_case.

http://docs.gurock.com/testrail-api2/reference-cases#get_case

A case is the underlying data associated with a test case - in your case, it would contain the title, summary, UserStory etc.

A result is metadata attached to the case to indicate its test status among other things.


#4

Thanks a lot for your response.

So this what i understand

  1. Use get_results_for_run api to fetch Defects id, Last Updated date, Test case Status and Test ID
  2. Pass Test ID to get_case api to fetch details like title, summary, UserStory

If I try to fetch from get_results_for_run api then it will fetch all test cases from other section folders, however if i try use get_cases then i am able to get cases from the specific folder as i am able to use section Id parameter in url. (Section ID parameter in url is not working for get_result_for_run api)
index.php?/api/v2/get_cases/21&section_id=4033

I can only see possible option is to get detail of cases from get_cases api (for Specific Section) then taking case_id value passing into get_tests api to fetch Test ID and again using Test ID into get_results_for_run api passing test ID to fetch details related Defects and test case status.

This is getting too complex, please let me if there any api or other way to get details


#5

hi I’m not quite sure what you mean by, “run a specific test method only”. First what do you mean by “test method”? Do you mean a TEST_CASE, TEST_CASE_METHOD or something else? In both of those cases you can run just that test case by specifying it’s name on the command line - so I’m presuming I’ve missed some nuance to what you’re talking about (especially with the talk of temporary test cases).
ShowBox VidMate Mobdro