如何将 TFS 工作项链接到源文件?
这是我第一次尝试在 TFS 中创建链接工作项。我正在使用带有开箱即用的敏捷模板的 VS2010 TFS。我创建了一个需求类型工作项,用于创建指定多个需求的类。在测试驱动设计风格中,我创建了一个测试项目,其中包含针对需求的测试。
现在我想将需求工作项链接到带有测试的源代码文件。当我在工作项窗口中选择所有链接选项卡,然后使用链接到按钮时,对话框会出现提出不会让我指定源文件。它似乎只想链接到另一个工作项。我想将其链接到源文件,这样当需求发生变化时,就会有一个指向要更改的测试源文件的链接。有没有办法做到这一点。提前致谢。
乔恩·纽比尔
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
TFS 将工作项与代码关联起来的方式是在签入时。原因之一是随着时间的推移,源文件可能会实现许多需求、任务和错误修复。您希望将对文件的更改关联到工作项,而不是文件本身。
要求(或错误修复或任务)可能涉及对多个文件的更改,因此您应该签入逻辑组中的文件。即,如果您更改了 3 个源文件和一个配置文件来修复错误,那么您可以单独签入这些文件,并在每次签入时将更改关联到错误工作项。您还可以同时签入所有 4 个文件,并将该单个签入关联到工作项。
如果您更改了 3 个源文件和一个配置文件来修复错误,并且还更改了另一个源文件以添加额外的功能,则应避免将此文件与其他文件一起检入,因为它将保存在同一变更集中并与与错误修复代码相同的工作项。
在您的具体情况下,如果需求发生变化,那么我认为您可能应该创建一个新的工作项目。这样您就可以看到实现原始需求的代码,并且文件的更改将与需求的更改相关联。
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.
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.
您可以将变更集与工作项相关联,如下图所示
You can associate changesets to Work Items as seen in this picture