开发者

TeamBuild: How to create a bug on a partially successful build

开发者 https://www.devze.com 2022-12-20 19:43 出处:网络
I am using TFS 2008 and writing my builds using the built-in TeamBuild.I have the build set up in such a way that it will create a work item of type Bug upon failure, and will also create a bug upon u

I am using TFS 2008 and writing my builds using the built-in TeamBuild. I have the build set up in such a way that it will create a work item of type Bug upon failure, and will also create a bug upon unit test failure. However; today our build partially succeeded due to the fact that an exec task kicked off an executable which had a return code that was not 0.

My question then; is there some way to determine a partial succession of a build and create a bug work item based on that detection?

A snippet from the build .proj file in which I create a bug based on a failed unit test run:

<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. $(BuildlogT开发者_Python百科ext)"
                   TeamProject="$(TeamProject)"
                   TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
                   Title="Unit Test Failure in $(BuildNumber)"
                   WorkItemFieldValues="$(WorkItemFieldValues)"
                   WorkItemType="Bug"
                   Condition=" '$(IsDesktopBuild)' != 'true' and '$(TestSuccess)' != 'true' ">
</CreateNewWorkItem>

Any help would be greatly appreciated, thanks!


You could try to check for the error in another part of the build life cycle like

AfterDropBuild

You find the different targets to extend here

0

精彩评论

暂无评论...
验证码 换一张
取 消