Walkthrough: Tracking Work Items
This walkthrough demonstrates how you can create work items and track them through a complete project in Visual Studio 2005 Team Foundation Server. It shows you how to use the project checklist to make sure key steps are taken during each phase of your project.
After you complete this walkthrough, you will see how easy it is to integrate work items with the rest of your project processes.
In this walkthrough, you will complete the following tasks:
Add new work items.
View work items.
Search for work items.
Create a simple work item query.
Customize the query results.
Group query clauses.
Note
This topic is based on the work item types and queries for MSF for Agile Software Development. If your project uses a different methodology, your work item types and queries might be different. MSF for Agile Software Development is one of the process guidance templates that are included with Team Foundation. For more information, see Finding and Using Process Guidance.
Prerequisites
An existing Team Foundation Server connection. For more information, see How to: Connect to Team Foundation Server
An existing team project. For more information, see How to: Create a Team Project. This topic refers to a fictional team project named AdventureWorks. However, you can substitute your own team project name instead of AdventureWorks.
One or more Team Foundation users to whom you can assign work items. For more information, see How to: Add a User.
When you start Visual Studio, Team Explorer opens the project in a separate pane that you can dock. By default, every project folder includes the following folder nodes in the team project tree:
Work Items Includes the team project's Team Queries and My Queries that are described later in this walkthrough.
Documents Includes the documents made available for your document teams by your project administrator.
Reports Includes the reports available for your work item methodology and those created by your project administrator.
Team Builds Provides access to the build features in Team Foundation.
Source Control Provides access to source control features in Team Foundation.
Besides the folder for the new project, you will see a My Favorites folder at the top of the folder list. You can add shortcuts to the My Favorites folder to quickly access frequently used work items.
Required Permissions
To perform this walkthrough, you must either be a member of the Contributors group or have the View work items in this node and Edit work items in this node permissions set to Allow. To save a query as a team query, you must be a member of the Project Administrators group. For more information, see Team Foundation Server Permissions.
Adding New Work Items
Every piece of work in a project is a work item. An important goal of any project is to follow all these work items until they are completed. If your team project uses the MSF for Agile Software Development process guidance that ships with Team Foundation, you have the following work item types:
Scenario A description of the user's need or request.
Bug A defect or deviation between expected and observed behavior in the product.
Quality of Service Requirement An expected deliverable of the final product. The deliverable can be an outcome, a problem solved, a feature, and so on.
Task A stand-alone action that must be accomplished by a person or group of people.
Risk A probable event or condition that can have a potentially negative outcome on the project in the future.
To add a new bug work item
In Team Explorer, select the AdventureWorks team project.
Right-click the Work Items folder, point to Add Work Item, and then click Bug.
In the Title field, type AdventureWorks Bug.
Complete the form by filling in the fields on the form. To save the work item, you must fill in all required fields.
Required fields are a different color.
On the File menu, click Save New Bug <number>.
When you save the bug, Team Foundation assigns it an ID number. This enables you to track it through your project. For reference in another procedure in this walkthrough, write down this ID number.
To complete this walkthrough, you must add several work items that have different values in the required fields. For example, add one bug with a priority of "1" and assign it to yourself. Add another with a priority of "1" and assign it to someone else on the team. Next, add several Quality of Service Requirements and assign them to yourself or other team members. Continue to add 8-10 work items in some combination of the five available work item types. When you have a variety of work item types, you can search for the work items by these differences.
View Work Items
You can open any item from the team project you are currently working in or from other team projects you have registered.
To view all work items assigned to you
After you have created several work items and assigned them to other members of your team, open Team Explorer, and, in the Work Items node, open Team Queries.
Double-click the My Work Items query to search for any items assigned to you.
Select a work item from the Results List window, and then double-click a work item to open the work item form.
Because work item IDs are unique across all team projects and all work item types, it is easy to find a work item if you already know the ID.
To locate a specific work item
On the Team menu, click Go To Work Item.
In the Go To Work Item dialog box, type the ID number.
Click OK to open the work item.
Searching for Work Items
Use searches, or queries, to locate work items that match specific criteria. The criteria you specify depend on the information that you need. Each line of a query is called a query clause. If you think of creating a query as you do of asking a question, clauses are the way that you refine your question to get the best possible set of answers.
Warning
For best results, add at least one clause to a query before running it. A query without a clause initiates a search of the entire team project. The larger the team project, the more time and resources the search takes if you do not specify clauses. A poorly designed query can affect Team Foundation Server performance for the whole team.
To find and run an existing work item query
From the Team Queries folder in the Work Items node, select the All Work Items query.
Double-click the query name.
The query appears in Results View with the Query Results on top and the Work Item form under it.
Creating a Simple Work Item Query
By using the work items that you just created, you can create a simple query that finds one or more items that meet the criteria.
To create a simple work item query
In the Work Items node, right-click the My Queries node, and then click Add Query.
Add query clauses until you are satisfied that you have the answer that you want. For example, add a clause for Priority = 1, and then add another clause for **Activated By = @me** (@me automatically inserts your alias).
Note
For more complex queries, test your query by searching a smaller subset of known results. If you have to, you can refine the query before you run it on your entire team project. For example, you could test the query on only those work items assigned to you before you run it on those assigned to everyone in your group.
On the query view toolbar, click Run.
The results appear in the Query Results list.
On the File menu, select Save New Query <query number> [Query].
On the Save Query As dialog box, under Name, type MyQuery1, and select My query (only visible to me).
Click Save to save the query to your My Queries folder.
Customizing Your Query Results
After you run a query for the first time, you might want to customize the display of your query results.
To change the fields you see in your Query Results
Click the Query View toolbar and select Column Options.
In the Column Options dialog box, select the Fields tab.
Under Available columns, select Work Item Type.
Note
If you want to see more columns, hold down the CTRL key and then click to select more than one column. Column names are listed under Available columns in alphabetical order.
Click > to copy the selection to Selected columns.
Note
To remove any columns in the query results list, select the column name under Selected columns, and then click <.
Note
To change the positions of columns in the query results list, select the column and then click the up or down arrows in the dialog box.
Click OK to save the options, and view the selected column for the query results.
To sort the Query Results List
Click the Query View toolbar and select Column Options.
In the Column Options dialog box, select the Sorting tab.
Under Available Columns, select the column Work Item Type.
Click > to copy the selection to Selected Column.
Note
To remove any columns in the query results list, select the column name under Selected columns, and then click <.
In the Selected columns box, select a column, and then click the up and down arrows in the dialog box to control which columns are sorted first.
In the Selected columns box, select a column, and then click the ascending or descending icons to control the sort direction.
Click OK to save the options.
Grouping Query Clauses
When you are working with large amounts of data or when you need accurate totals, you should organize the pieces that make up your query in the order that gives you the best possible results.
**Add, remove, and move query clauses ** Test the results as you go. In this manner, most queries are created.
Group clauses Grouping query clauses is like putting parentheses around an expression in a mathematical equation.
To group query clauses
Select the last two query clauses in the query you created previously.
Right-click and select Group Clauses.
A bracket that looks like a parenthesis surrounds the two rows.
Saving a Query
When you have a query that retrieves the results you want, you may want to save it to use later.
To save a query
Create a query.
On the File menu, click Save New Query <query number> [Query].
In the Save Query As dialog box, under Name, type a name for your query.
Under Select the query type and save location, select where you want to save the query:
To allow for your query to be used by other team members, select Team query (visible to everyone).
Note
To save your query as a Team Query, you must have Project Administrator permissions.
To save your query to your private query folder, select My query (visible only to me), and then select which team project where you want to store the query.
To save your query to a file that you can send in e-mail, select File, and then enter the folder and file name where you want to save the file. Team Foundation saves the query with the .wiq extension.
Click Save.
See Also
Tasks
Walkthrough: Adding Links and Attachments to Work Items