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

Testrail: Fetching testrail runids from hierarchical milestones

Hi !

At my workplace, we seem to be having a hierarchy of milestones as follows:

Milestone1
Milestone2
Run Id 1
Run Id 2
Milestone3
Run Id 3
Run Id 4

Is there a sample of an API which I can use to parse this hierarchical tree and eventually fetch all the unique run_ids under individual milestones ?

OR

Is there a way, if given a milestone, I can traverse all the run ids underneath it, irrespective of the level of hierarchy present within ?

I’ve tried googling this a lot, but am unable to get the info, I’m looking for.

Would appreciate some help in this regard.

Thanks and regards,
Akshay

Hi @askothare,

I don’t have a running exampke for you, but it isn’t as complex.
But first, let me check one thing: Does your structure looks like this?

Milestone1
_Sub-Milestone2
__Run1
__Run2
_Sub-Milestone3
__Run3
__Run4

[I would suggest you to make use of TestPlans to structure it, because Milestones and Run are not really a structure, just a kind of link to get a timeframe in. But anyway…]

If we take your Milestone1 as starting point af an analysis, you can call get_milestone to get information about the content. Especially the sub-milestoneIds.

To get the runs for each sub-milestone (or also for the milestone itself, if you can’t guarantee there are no runs on milestone level) you can call get_runs by adding the sub-milestoneId as request filter. Either for each sub-milestone or combined for all with the need to search afterwards.

So, just two or three cycles, no big deal. At least I would try it this way…

Hope this helps a little bit… Don’t hesitate to ask further questions…

Karsten