2010-02-16 48 views
0

我正在使用TFS 2008并使用内置的TeamBuild编写我的版本。我有这样的构建方式,它会在失败时创建一个类型为Bug的工作项,并且还会在单元测试失败时创建一个错误。然而;今天,我们的构建部分成功,因为一个可执行任务启动了一个可执行文件,该可执行文件的返回码不是0.TeamBuild:如何创建一个部分成功的版本的bug

然后我的问题;是否有某种方法可以确定构建的部分连续性并基于该检测创建bug工作项目?

从我创建一个基于失败的单元测试运行中的错误构建.proj文件片段:

<Target Name="AfterTest"> 
<!-- Refresh the build properties. --> 
<GetBuildProperties TeamFoundationServerUrl="$(TeamFoundationServerUrl)" 
        BuildUri="$(BuildUri)" 
        Condition=" '$(IsDesktopBuild)' != 'true' "> 
    <Output TaskParameter="TestSuccess" PropertyName="TestSuccess" /> 
</GetBuildProperties> 

<!-- Set CompilationStatus to Failed if TestSuccess is false. --> 
<SetBuildProperties TeamFoundationServerUrl="$(TeamFoundationServerUrl)" 
        BuildUri="$(BuildUri)" 
        CompilationStatus="Failed" 
        Condition=" '$(IsDesktopBuild)' != 'true' and '$(TestSuccess)' != 'true' "> 
</SetBuildProperties> 

<CreateNewWorkItem BuildNumber="$(BuildNumber)" 
        BuildURi="$(BuildURI)" 
        Description="A failed test run caused the CreateNewWorkItem task created this bug. $(BuildlogText)" 
        TeamProject="$(TeamProject)" 
        TeamFoundationServerUrl="$(TeamFoundationServerUrl)" 
        Title="Unit Test Failure in $(BuildNumber)" 
        WorkItemFieldValues="$(WorkItemFieldValues)" 
        WorkItemType="Bug" 
        Condition=" '$(IsDesktopBuild)' != 'true' and '$(TestSuccess)' != 'true' "> 
</CreateNewWorkItem> 

任何帮助将是非常感谢,谢谢!

回答

0

你可以尝试在构建生命周期的另一部分来检查错误,如

AfterDropBuild 

你会发现不同的目标,以扩大here

+0

感谢您的答复。我对生命周期中检查错误的方式没有太多困惑,而是如何检查“部分成功”。 – 2010-02-16 14:15:46

相关问题