How can I link TFS work item to source file?
Asked Answered
N

2

5

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

Narra answered 6/4, 2011 at 22:59 Comment(0)
A
5

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.

Anchoress answered 7/4, 2011 at 0:2 Comment(1)
"You want to associate the changes to the file to a work item, not the file itself." Most of the time yes, but not all the time. You may want to link a workitem to a code file to remember to research it later, or to record what looks like a bug but you may not have time to look into it during the current task. The code review is close but is still linking to a shelfset.Ducat
E
3

You can associate changesets to Work Items as seen in this picture enter image description here

Eryneryngo answered 8/4, 2011 at 19:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.