更新:2007 年 11 月
Team Foundation 工作项跟踪 系统与 Team Foundation Server 和 Visual Studio Team System 的其他组件进行了集成。若要从组件集成中获取最大的好处,请在工作项类型中使用某些字段和操作。本主题介绍如何在下列情况下使用这些必需字段和操作:
- 与 Team Build 集成 
- 与 Visual Studio 测试工具集成 
- 与 Team Foundation 源代码管理集成 
与 Team Foundation Build 集成
Team Foundation Build 是 Team Foundation Server 的自动生成系统。您可以使用 Team Foundation Build 配置生成过程。Team Foundation Build 可以在生成失败时生成工作项,并且还可以向已在特定生成中解决的工作项添加生成信息。要完成此操作,Team Foundation Build 需要具有以下两个字段:Found In 和 Integration Build。
添加 Found in 字段
生成失败时,Team Foundation Build 会创建一个新工作项,并将 Found In 字段设置为出现失败的生成的内部版本号。在您希望 Team Foundation Build 在生成失败时创建的工作项类型中,必须存在 Found In 字段。如果缺少 Found In 字段,Team Foundation Build 不会为失败的生成创建工作项,但其他操作会按预期进行。
下表汇总了 Found In 字段属性的名称和值。
| 属性名称 | 属性值 | 
| RefName | Microsoft.VSTS.Build.FoundIn | 
| Name | 可以设置为任何名称,因为集成是基于字段引用名称(而不是字段名)进行的。 | 
| Type | String | 
Found In 字段的示例
<FIELD name="Found In" refname="Microsoft.VSTS.Build.FoundIn" type="String" reportable="dimension">
    <HELPTEXT>Product build number (revision) in which this item was found</HELPTEXT>
</FIELD>
添加 Integration Build 字段
Team Foundation Build 标识每次生成中解决的工作项,然后更新这些工作项,以设置解决这些工作项的内部版本号。它在 Integration Build 字段中设置内部版本号。如果缺少 Integration Build 字段,Team Foundation Build 将不会在工作项中存储内部版本号,但其他操作会按预期进行。
下表汇总了 Integration Build 字段属性的名称和值。
| 属性名称 | 属性值 | 
| RefName | Microsoft.VSTS.Build.IntegrationBuild | 
| Name | 可以设置为任何名称,因为集成是基于字段引用名称(而不是字段名)进行的。 | 
| Type | String | 
Integration Build 字段的示例
<FIELD name="Integration Build" refname="Microsoft.VSTS.Build.IntegrationBuild" type="String" reportable="dimension">
    <HELPTEXT>Product build number this bug was fixed in</HELPTEXT>
</FIELD>
与 Visual Studio 测试工具集成
Visual Studio 的某些版本包括一些集成到开发环境中的测试工具。测试工具提供的一项功能就是能够在测试失败时创建新工作项。若要执行此操作,请在“测试结果”窗口中右击要为其创建 Bug 的测试结果,指向“创建工作项”,然后单击要创建的工作项的类型,例如“Bug”。有关更多信息,请参见如何:基于测试结果创建工作项。
按这种方式创建工作项之后,将自动填充三个字段,以提供有关测试失败的信息。这三个字段分别为 TestName、TestId 和 TestPath。Test Edition 使用有关失败的测试的特定信息设置这三个字段。如果工作项中缺少 TestName、TestId 和 TestPath 字段,将不会设置这些字段,但其他操作会按预期进行。
下表汇总了这三个字段的属性的名称和值。
| 属性名称 | 属性值 | 
| RefName | Microsoft.VSTS.Test.TestName、Microsoft.VSTS.Test.TestId、Microsoft.VSTS.Test.TestPath | 
| Name | 可以设置为任何名称,因为集成是基于字段引用名称(而不是字段名)进行的。 | 
| Type | String | 
TestName、TestId 和 TestPath 字段的示例
<FIELD name="Test Name" refname="Microsoft.VSTS.Test.TestName" type="String" reportable="detail">
    <HELPTEXT>The name of the test that found this bug</HELPTEXT>
</FIELD>
<FIELD name="Test Id" refname="Microsoft.VSTS.Test.TestId" type="String" reportable="detail">
    <HELPTEXT>The Id of the test that found this bug</HELPTEXT>
</FIELD>
<FIELD name="Test Path" refname="Microsoft.VSTS.Test.TestPath" type="String" reportable="detail">
    <HELPTEXT>The full pathname of the test that found this bug</HELPTEXT>
与 Team Foundation 源代码管理集成
Team Foundation 版本控制 的一大功能就是,您可以在签入代码时关联或解决工作项。您可能在更改特定代码时使用了特定的工作项,处理完代码后,您可以在源代码管理签入窗口中设置相应的关联。
Team Foundation 版本控制 解决工作项的功能要求工作项包含一个特定操作。源代码管理系统然后查询工作项跟踪以确定工作项是否支持该操作,如果确实支持该操作,则还将查询转换的源和目标的状态。如果找到了相应的操作,在签入代码时,源代码管理系统就可以根据设置的转换对工作项进行转换。
| .gif) 说明: | 
|---|
| 当使用 Checkin 操作时,必须设置相应的“from”和“to”状态以反映需要的状态转换。 | 
有关这些操作的更多信息,请参见 将状态转换和操作相关联 和 转换操作详细信息。
Checkin 操作的示例
<TRANSITION from="Active" to="Resolved">
....
    <ACTIONS>
        <ACTION value="Microsoft.VSTS.Actions.Checkin"/>
    </ACTIONS>
....  
</TRANSITION>