views:

143

answers:

1

Hello,

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. $(BuildlogText)"
                   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!

A: 

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

Hakan Forss
Thanks for your response. I'm not as much confused on where in the life cycle to check for the error, rather HOW to check for "Partially Successful".
Scott Root