How to: Create and Manage Queries for Searching Using Microsoft Test Manager
You can create and manage your queries to search for work items in your Team Foundation Server using Microsoft Test Manager. You can create the following types of queries:
Default query: Returns a flat list of work items
Direct links query: Returns work items and any work items that are linked to these items
Tree query: Returns a multi-tiered set of work items
These types of queries can also be created using Visual Studio. For more information about these types of queries, see Query for Bugs, Tasks, or Other Work Items.
There are two categories of queries.
Team Queries These queries are available to everyone in your team project. Team Queries can only be created and modified by people who have been granted permission to create them by your team project administrator.
My Queries These queries are available only to you.
Requirements
- Visual Studio Ultimate, Visual Studio Premium, Visual Studio Test Professional
To create and manage queries using Microsoft Test Manager, use the following procedures:
Create a subfolder to store a query
Create a query
Edit a query
Rename a query
Delete a query
Requirements
- Visual Studio Ultimate, Visual Studio Premium, Visual Studio Test Professional
Create a Subfolder to Store a Query
To create a subfolder to store a query
Open Microsoft Test Manager.
Note
To display the Microsoft Test Manager window, choose Start, and then choose All Programs. Point to Microsoft Visual Studio 2012 and then choose Microsoft Test Manager.
To open the Queries activity, choose the down-arrow on the center group switcher and choose Testing Center.
In the center group menu bar, choose Track and then choose Queries.
The Queries activity is displayed.
To create a subfolder, right-click Team Queries folder, My Queries folder, or any other folder and then choose New folder.
Type the name for this new subfolder.
To add a query to this new subfolder, right-click this new subfolder and then select the type of query that you want to create.
Create a Query
To create a query
Open Microsoft Test Manager.
Note
To display the Microsoft Test Manager window, choose Start, and then choose All Programs. Point to Microsoft Visual Studio 2012 and then choose Microsoft Test Manager.
To open the Queries activity, choose the down-arrow on the center group switcher and choose Testing Center.
In the center group menu bar, choose Track and then choose Queries.
The Queries activity is displayed.
To select the folder where you want to create the query, choose the folder in the queries folder hierarchy.
To create a query, right-click on the folder and in the shortcut menu, point to the type of query that you want to create.
To enter a name for this query, type the name.
Important
The first clause shown for the query makes sure that only items from your team project are returned in the results of the query. Do not change this clause.
You can now add the clauses that you require for this query. For more information about how to specify the criteria for your query, see Specify Query Filter Criteria.
(Optional) To change the columns or the sort order for the query results, choose Column options.
In the Column Options dialog box, select the columns to add from Available columns, and then choose the arrow to add these columns to the Selected columns.
Choose Sorting and select the columns that you want to sort by.
Choose OK.
(Optional) To group the query results by a column, drag a column header in the query results table to the title bar of the query results.
When the query you created returns the work items that you want to view, choose Save on the toolbar.
The query is now saved.
Edit a Query
To edit a query
Open Microsoft Test Manager.
Note
To display the Microsoft Test Manager window, choose Start, and then choose All Programs. Point to Microsoft Visual Studio 2012 and then choose Microsoft Test Manager.
To open the Queries activity, choose the down-arrow on the center group switcher and choose Testing Center.
In the center group menu bar, choose Track and then choose Queries.
The Queries activity is displayed.
To display the clauses for a query, choose the query in the tree view in Queries.
To update the query, edit the existing clauses or add new clauses.
To see the results of your query, choose Run to run the query.
(Optional) To change the columns or the sort order for the query results, choose Column options.
In the Column Options dialog box, select the columns to add from Available columns, and then choose the arrow to add these columns to the Selected columns.
Choose Sorting and select the columns that you want to sort by.
Choose OK.
When the query you created returns the correct items that you want to view, choose Save on the toolbar.
The query is now updated.
Rename a Query
To rename a query
Open Microsoft Test Manager.
Note
To display the Microsoft Test Manager window, choose Start, and then choose All Programs. Point to Microsoft Visual Studio 2012 and then choose Microsoft Test Manager.
To open the Queries activity, choose the down-arrow on the center group switcher and choose Testing Center.
In the center group menu bar, choose Track and then choose Queries.
The Queries activity is displayed.
To rename a query, right-click the query in the tree view in Queries and then choose Rename.
Type the new name for this query.
The query is now displayed with the new name in the tree view of queries.
Delete a Query
To delete a query
Open Microsoft Test Manager.
Note
To display the Microsoft Test Manager window, choose Start, and then choose All Programs. Point to Microsoft Visual Studio 2012 and then choose Microsoft Test Manager.
To open the Queries activity, choose the down-arrow on the center group switcher and choose Testing Center.
In the center group menu bar, choose Track and then choose Queries.
The Queries activity is displayed.
To delete a query, right-click the query in the tree view in Queries and then choose Delete.
A confirmation dialog box is displayed.
To confirm deletion of the query, choose Delete query.
The query is no longer displayed in the tree view of queries.