Writing queries in TFS is really simple, right?
“Here you go…”
“Errr, let me think about that!”
That’s why with TFS 2013 I always found it easiest to open up my Backlog, change the view to show a tree, for example Features to Tasks…
Then I could hit that little Create Query button…
name my query…
And Bob’s your uncle, I have a starting point Tree Query generated for me that I can mess around with to get what I need.
I did this as normal on Visual Studio Team Services (formerly Visual Studio Online or VSO) the other day and to my horror, my generated query didn’t show the hierarchy I was looking at in my backlog view meaning that I actually had to think about it for the first time in a while!
In VSTS/TFS 2015, the backlog view has changed a little and now the Parent/Child view is either On or Off.
The create query button is still there and it generates a tree query but it only shows Product Backlog Items or Bugs with any nested items the have (which I don’t encourage you to do, keep that backlog flat as you can’t reprioritise nested items independently).
So I had to generate my own starting query.
In this instance I just wanted EVERYTHING, but in a hierarchical view so I started here:
What this tree query is doing is to match the top level clause first (Any work item) and then match any child items which meet the criteria (Any work item) which in this case showed Epics – Tasks, ignoring any state or other criteria such as Area or Iteration Paths.
If I look at the generated query from TFS 2013 we can see what it is doing (and understand why TFS 2015 doesn’t work that way anymore)
Remember this query was looking at Features and then any linked Features, Bugs, PBIs or Tasks. Any PBI not rolling up to a Feature would not appear in the results. Also, importantly the query is sorted by Backlog Priority followed by ID.
If we look at an alternative view which is Backlog Items to Features, what it will show is my entire backlog of PBIs/Bugs and any parent Features. Any Features that do not have child Requirements will not show up in the results.
The difference here is that we are comparing the linked Work Items first (any PBIs/Bugs meeting the criteria) and then looking for any parent items that they have that are either more requirements or Features.
In TFS 2015/VSTS the generated query I initially expected is probably closer to my Any Item linked to Any Item query, just with a few restrictions. For instance my top level query might look something like this if I want to see Features, Bugs, PBIs and Tasks and any Children they have.
Think carefully about what you want to see at the top level. Maybe you only want to see Features (or Epics or whatever) and the tree below them – and then have a separate query for any orphaned PBIs, Bug or Tasks. There are lots of edge cases such as a PBI in an active state but its parent is closed so make sure you’re not losing things.
Good queries are really only useful against a well organized backlog. If you need help to organise your backlog and really understand how your project is doing then get in touch with RippleRock.
Email Richard Erwin
© Copyright 2018 RippleRock