How to fail build if test method fails?

廉价感情. 提交于 2020-01-02 08:12:52

问题


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


回答1:


From within TFS 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.



来源:https://stackoverflow.com/questions/20045028/how-to-fail-build-if-test-method-fails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!