Share via


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

  1. 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.

  2. To open the Queries activity, choose the down-arrow on the center group switcher and choose Testing Center.

  3. In the center group menu bar, choose Track and then choose Queries.

    The Queries activity is displayed.

  4. To create a subfolder, right-click Team Queries folder, My Queries folder, or any other folder and then choose New folder.

  5. Type the name for this new subfolder.

  6. 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

  1. 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.

  2. To open the Queries activity, choose the down-arrow on the center group switcher and choose Testing Center.

  3. In the center group menu bar, choose Track and then choose Queries.

    The Queries activity is displayed.

  4. To select the folder where you want to create the query, choose the folder in the queries folder hierarchy.

  5. 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.

  6. 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.

  7. (Optional) To change the columns or the sort order for the query results, choose Column options.

    1. 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.

    2. Choose Sorting and select the columns that you want to sort by.

    3. Choose OK.

  8. (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.

  9. When the query you created returns the work items that you want to view, choose Save on the toolbar.

  10. The query is now saved.

Edit a Query

To edit a query

  1. 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.

  2. To open the Queries activity, choose the down-arrow on the center group switcher and choose Testing Center.

  3. In the center group menu bar, choose Track and then choose Queries.

    The Queries activity is displayed.

  4. To display the clauses for a query, choose the query in the tree view in Queries.

  5. To update the query, edit the existing clauses or add new clauses.

  6. To see the results of your query, choose Run to run the query.

  7. (Optional) To change the columns or the sort order for the query results, choose Column options.

    1. 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.

    2. Choose Sorting and select the columns that you want to sort by.

    3. Choose OK.

  8. 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

  1. 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.

  2. To open the Queries activity, choose the down-arrow on the center group switcher and choose Testing Center.

  3. In the center group menu bar, choose Track and then choose Queries.

    The Queries activity is displayed.

  4. To rename a query, right-click the query in the tree view in Queries and then choose Rename.

  5. 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

  1. 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.

  2. To open the Queries activity, choose the down-arrow on the center group switcher and choose Testing Center.

  3. In the center group menu bar, choose Track and then choose Queries.

    The Queries activity is displayed.

  4. To delete a query, right-click the query in the tree view in Queries and then choose Delete.

    A confirmation dialog box is displayed.

  5. To confirm deletion of the query, choose Delete query.

    The query is no longer displayed in the tree view of queries.

See Also

Tasks

How to: Search for Test Cases from Microsoft Test Manager