Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I link TFS work item to source file?

This is my first attempt at creating linked work items in TFS. I'm using VS2010 TFS with the Agile template out of the box. I created a Requirements type Work Item for creating a class specifying several requirements. In Test Driven Design style I created a test project with tests for the requirements.

Now I would like to link the Requirements Work Item to the source code file with the tests. When I select the All Links tab in the Work Item window and then use the Link to button the dialog it brings up won't let me specify a source file. It seems to only want to link to another Work Item. I'd like to link it to the source file so when the requirements change there will be a link to the test source file to be changed. Is there a way to do this. Thanks in advance.

Jon Newbill

like image 820
JonN Avatar asked Apr 06 '11 22:04

JonN


People also ask

How do I open a TFS works item in Visual Studio?

You can start viewing and adding work items once you connect to a project. (1) Check that you've selected the right project, then (2) choose Boards>Work Items. Open Visual Studio 2019, Team Explorer, and then choose Work Items.

How do I add attachments to TFS?

Drag and Drop Open up Windows Explorer, find the file you want to add, open up a Work Item to the Attachments tab. Drag the item from Windows Explorer to the Attachments tab and you're done.

How do I create a work item in TFS?

To do this you need to open your Team Project in the Web Access and click to create a new Work Item for whatever type that you want. In this case it is the Product Backlog Item. I have then gone ahead and changed the Area Path, Iteration Path and added a value for Business Value.


1 Answers

The way TFS associates work items with code is at checkin. One of the reasons for this is that a source file might implement many requirements, tasks and bug fixes over time. You want to associate the changes to the file to a work item, not the file itself.

TFS Checkin dialogue

A requirement (or bug fix or task) might involve changes to multiple files so you should checkin files in logical groups. I.e. if you've changed 3 source files and a config file to fix a bug then you can check those files in separately and associate the changes to the bug work item at each checkin. You could also check in all 4 files at the same time and associate that single checkin to the work item.

If you change 3 source files and a config file to fix a bug, and you have also changed another source file to add extra functionality, you should avoid checking this file in with the others as it will be held in the same changeset and associated with the same work items as the bug fix code.

In your specific case, if the requirements change then I think you should probably create a new work item. That way you can see the code that implemented the original requirement and the changes to the file will be associated to the change in requirements.

like image 180
James Reed Avatar answered Sep 28 '22 15:09

James Reed