Fail a build if tests fail

TL;DR

Explains how to configure TFS 2008 builds to automatically fail if any tests fail by setting TreatTestFailureAsBuildFailure to true in the build project file.

1 May 2009
Written by Martin Hinshelwood
1 minute read
Comments
Subscribe

It took me longer than I thought it would to find this, but is you are using TFS2008 and you want builds to fail if any of the tests fail then you can add the following to the tests properties group in your build project (TFSBuild.prof)

<PropertyGroup>
  <!-- TEST ARGUMENTS
   If the RunTest property is set to true, then particular tests within a
   metadata file or test container may be specified here.  This is
   equivalent to the /test switch on mstest.exe.

   <TestNames>BVT;HighPriority</TestNames>
  -->
  <TreatTestFailureAsBuildFailure>true</TreatTestFailureAsBuildFailure>
</PropertyGroup>

Very handy…

Technorati Tags: TFBS  ALM  TFS 2008

Smart Classifications

Each classification [Concepts, Categories, & Tags] was assigned using AI-powered semantic analysis and scored across relevance, depth, and alignment. Final decisions? Still human. Always traceable. Hover to see how it applies.

Comments
Subscribe

What to read next

Article Engineering Excellence

Solution: Testing Web Services with MSTest on Team Foundation Build Services 2010

Explains how to configure MSTest for automated testing of web services on Team Foundation Build Services 2010, including handling dynamic …

Read article
Article Scrum

Finding the problem on a partially succeeded build on Team Foundation Build Services 2010

Learn how to diagnose and resolve partially succeeded builds in Team Foundation Build Services 2010 by tracing test failures, identifying …

Read article
Article

TFS Error: MSB4018 The "BuildShadowTask" task failed unexpectedly

Explains the MSB4018 "BuildShadowTask" error in TFS when using Accessors in unit test projects, its cause, and how removing .accessor files …

Read article
Article Engineering Excellence

Who broke the build?

Explains the importance of passing builds, common causes of build failures, how to identify issues and responsible users, and best practices …

Read article