如果测试方法失败,如何构建失败?
我的参考是这个 http://msdn.microsoft.com/de-de/library/ms182532.aspx
使用 Visual Studio.假设有一个包含一些项目和一个单元测试项目的解决方案 Project.SuperApp
.如果我想运行测试,我首先必须构建解决方案,然后从 Test-Explorer 运行所有测试.即使一项测试失败,软件也已经构建并准备好部署.这对我来说似乎是一个错误.
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.
使用诸如 Maven
之类的其他工具,如果您想构建/打包软件组件,则首先执行测试.如果一项测试失败,则即使编译也不会构建/打包软件组件.
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.
如何告诉 Visual Studio 先执行测试用例,如果一个测试用例失败则构建失败?
How to tell Visual Studio to execute the test cases first and fail the build if one test case fails?
提前致谢
在 TFS 中,您可以按照以下步骤将其配置为在测试失败时失败:
From within TFS you can configure it to fail on the tests failing by following these steps:
- 编辑构建定义"
- 选择流程
- 在 2. Basic > Authomated Tests > 下选择测试程序集,您将看到Fail Build On Test Failure".将其设置为 true.