Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fail build if test method fails?

My Reference is this http://msdn.microsoft.com/de-de/library/ms182532.aspx

Using Visual Studio. Lets say there is a Solution Project.SuperApp with some projects and one unit test project. If i want to run the tests i first have to build the solution and then run all tests from the Test-Explorer. Even if one test fails the software is already build and ready to deploy. Which seems like an error to me.

With other tools like Maven if you want to build/package a software component the tests are executed first. If one test fails the software component is not build/packaged even if it compiles.

How to tell Visual Studio to execute the test cases first and fail the build if one test case fails?

Thanks in advance

like image 976
FuryFart Avatar asked Jan 21 '26 01:01

FuryFart


1 Answers

From within TFS (Team Foundation Server, now known as Azure DevOps Server) you can configure it to fail on the tests failing by following these steps:

  1. Edit the 'build definition'
  2. Select Process
  3. Under 2. Basic > Authomated Tests > Select the test assembly and you will see 'Fail Build On Test Failure. Set that to true.

enter image description here

like image 162
hutchonoid Avatar answered Jan 22 '26 17:01

hutchonoid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!