<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How to: Fail a Build When Tests Fail</title><link>http://blogs.msdn.com/aaronhallberg/archive/2007/11/05/how-to-fail-a-build-when-tests-fail.aspx</link><description>Got an email from Martin Woodward this morning asking: What would be your preferred way to fully fail the build on test failure rather than partially succeed the build? A bit of background - Team Build 2008 marks builds as Succeeded if no errors are encountered</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>VSTS Links - 11/06/2007</title><link>http://blogs.msdn.com/aaronhallberg/archive/2007/11/05/how-to-fail-a-build-when-tests-fail.aspx#5937095</link><pubDate>Tue, 06 Nov 2007 17:35:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5937095</guid><dc:creator>Team System News</dc:creator><description>&lt;p&gt;The SRL Team Blog on Start working with eclipse and VSTS (basic needs). Tiago Pascoal on TFS: Fetching...&lt;/p&gt;
</description></item><item><title>re: How to: Fail a Build When Tests Fail</title><link>http://blogs.msdn.com/aaronhallberg/archive/2007/11/05/how-to-fail-a-build-when-tests-fail.aspx#6343034</link><pubDate>Sat, 17 Nov 2007 23:04:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6343034</guid><dc:creator>BassettHound</dc:creator><description>&lt;p&gt;I am getting an error with this. &amp;nbsp;I have tried Status, BuildStatus and CompilationStatus, all yield the same result which is as (or similar) to below.&lt;/p&gt;
&lt;p&gt;I would like to get the build to fail, not &amp;quot;partiallly succeed&amp;quot;.&lt;/p&gt;
&lt;p&gt;What might I be doing wrong?&lt;/p&gt;
&lt;p&gt;c:\d\BuildType\TFSBuild.proj(335,25): error MSB4030: &amp;quot;Failed&amp;quot; is an invalid value for the &amp;quot;CompilationStatus&amp;quot; parameter of the &amp;quot;SetBuildProperties&amp;quot; task. The &amp;quot;CompilationStatus&amp;quot; parameter is of type &amp;quot;Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus&amp;quot;.&lt;/p&gt;
&lt;p&gt;Task &amp;quot;SetBuildProperties&amp;quot;&lt;/p&gt;
&lt;p&gt;c:\d\BuildType\TFSBuild.proj(335,25): error MSB4030: &amp;quot;Microsoft.TeamFoundation.Build.Client.BuildStatus.Failed&amp;quot; is an invalid value for the &amp;quot;Status&amp;quot; parameter of the &amp;quot;SetBuildProperties&amp;quot; task. The &amp;quot;Status&amp;quot; parameter is of type &amp;quot;Microsoft.TeamFoundation.Build.Client.BuildStatus&amp;quot;.&lt;/p&gt;
&lt;p&gt;Done executing task &amp;quot;SetBuildProperties&amp;quot; -- FAILED.&lt;/p&gt;
&lt;p&gt;Done building target &amp;quot;AfterTest&amp;quot; in project &amp;quot;TFSBuild.proj&amp;quot; -- FAILED.&lt;/p&gt;
&lt;p&gt;Done Building Project &amp;quot;c:\d\BuildType\TFSBuild.proj&amp;quot; (EndToEndIteration target(s)) -- FAILED.&lt;/p&gt;
&lt;p&gt;Task &amp;quot;SetBuildProperties&amp;quot;&lt;/p&gt;
&lt;p&gt;c:\d\BuildType\TFSBuild.proj(335,25): error MSB4030: &amp;quot;Failed&amp;quot; is an invalid value for the &amp;quot;Status&amp;quot; parameter of the &amp;quot;SetBuildProperties&amp;quot; task. The &amp;quot;Status&amp;quot; parameter is of type &amp;quot;Microsoft.TeamFoundation.Build.Client.BuildStatus&amp;quot;.&lt;/p&gt;
&lt;p&gt;Done executing task &amp;quot;SetBuildProperties&amp;quot; -- FAILED.&lt;/p&gt;
&lt;p&gt;Done building target &amp;quot;AfterTest&amp;quot; in project &amp;quot;TFSBuild.proj&amp;quot; -- FAILED.&lt;/p&gt;
&lt;p&gt;Done Building Project &amp;quot;c:\d\BuildType\TFSBuild.proj&amp;quot; (EndToEndIteration target(s)) -- FAILED.&lt;/p&gt;
</description></item><item><title>re: How to: Fail a Build When Tests Fail</title><link>http://blogs.msdn.com/aaronhallberg/archive/2007/11/05/how-to-fail-a-build-when-tests-fail.aspx#6400210</link><pubDate>Mon, 19 Nov 2007 16:23:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6400210</guid><dc:creator>aaronhallberg</dc:creator><description>&lt;p&gt;Ah yes - there was a bug in earlier versions of the SetBuildProperties task where these properties were of their *real* enum types (BuildPhaseStatus/BuildStatus) rather than strings. &amp;nbsp;I had assumed - wrongly - that MSBuild could manage the conversion for me. &amp;nbsp;I believe the issue should be fixed in Orcas Beta 2 - let me know if I am incorrect here. &amp;nbsp;If so, it is *definitely* fixed in the RTM version, which should be released here shortly... &amp;nbsp;Sorry for the confusion!&lt;/p&gt;
</description></item><item><title>re: How to: Fail a Build When Tests Fail</title><link>http://blogs.msdn.com/aaronhallberg/archive/2007/11/05/how-to-fail-a-build-when-tests-fail.aspx#6985851</link><pubDate>Sat, 05 Jan 2008 06:07:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6985851</guid><dc:creator>BassettHound</dc:creator><description>&lt;p&gt;Aaron,&lt;/p&gt;
&lt;p&gt;We're getting some funky behavior with this using MaxProcesses=2.&lt;/p&gt;
&lt;p&gt;With MaxProcesses=2, we're getting TestSuccess=False using the code below. &amp;nbsp;All unit test have passed.&lt;/p&gt;
&lt;p&gt;Thoughts?&lt;/p&gt;
&lt;p&gt;tim&lt;/p&gt;
&lt;p&gt; &amp;nbsp;&amp;lt;Target Name=&amp;quot;AfterTest&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;GetBuildProperties TeamFoundationServerUrl=&amp;quot;$(TeamFoundationServerUrl)&amp;quot; BuildUri=&amp;quot;$(BuildUri)&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Output TaskParameter=&amp;quot;TestSuccess&amp;quot; PropertyName=&amp;quot;TestSuccess&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;/GetBuildProperties&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;Message Text=&amp;quot;TestSuccess='$(TestSuccess)'&amp;quot; /&amp;gt;&lt;/p&gt;
</description></item><item><title>re: How to: Fail a Build When Tests Fail</title><link>http://blogs.msdn.com/aaronhallberg/archive/2007/11/05/how-to-fail-a-build-when-tests-fail.aspx#7307679</link><pubDate>Tue, 29 Jan 2008 19:03:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7307679</guid><dc:creator>aaronhallberg</dc:creator><description>&lt;p&gt;I suspect there is a race condition here when using multiproc MSBuild... &amp;nbsp;The TestSuccess property is just a helper property that checks whether TestStatus is BuildPhaseStatus.Succeeded - it being false doesn't necessarily mean that tests have *failed* - they could just still be marked as BuildPhaseStatus.Unknown, since the logger hasn't had a chance to update the status yet. &amp;nbsp;You could verify this by printing out TestStatus in addition to TestSuccess.&lt;/p&gt;
&lt;p&gt;If this is the issue, the best approach I can come up with would be to write you own custom task to check the test status which sleeps for a while if it is BuildPhaseStatus.Unknown.&lt;/p&gt;
</description></item><item><title>Orcas SP1 TFS Build Changes, Part 2</title><link>http://blogs.msdn.com/aaronhallberg/archive/2007/11/05/how-to-fail-a-build-when-tests-fail.aspx#8493998</link><pubDate>Mon, 12 May 2008 16:18:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8493998</guid><dc:creator>Aaron Hallberg</dc:creator><description>&lt;p&gt;As promised, here are some more details on other SP1 changes for TFS Build.&amp;amp;#160; 3. Detect test results.&lt;/p&gt;
</description></item><item><title>re: How to: Fail a Build When Tests Fail</title><link>http://blogs.msdn.com/aaronhallberg/archive/2007/11/05/how-to-fail-a-build-when-tests-fail.aspx#9000743</link><pubDate>Wed, 15 Oct 2008 19:43:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9000743</guid><dc:creator>ritmeijer@hotmail.com</dc:creator><description>&lt;p&gt;Not sure if this is because I am on TFS 2008, but simply specifying the following in a &amp;lt;PropertyGroup&amp;gt; achieves the same.&lt;/p&gt;
&lt;p&gt;&amp;lt;TreatTestFailureAsBuildFailure&amp;gt;true&amp;lt;/TreatTestFailureAsBuildFailure&amp;gt;&lt;/p&gt;
</description></item></channel></rss>