停止对安装失败运行测试
我们正在使用 NUnit 来运行大量集成测试。
所有这些测试共享一个基类,该基类作为测试夹具设置方法,准备其余测试所需的数据。
如果测试夹具设置出现故障,是否有任何方法可以停止运行测试?
现在它会等到所有测试因相同的设置错误而失败
We are using NUnit to run a large number of integration tests.
All these tests share a base class, which as a test fixture setup method that preps the data needed for the rest of the tests.
Is there any way to stop running tests if there is a failure in the test fixture setup?
Right now it waits until all the tests fail with the same setup error
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我理解正确的话,如果遇到失败,您不能在 [Setup] 方法或 [SetupFixture] 类中的某个地方抛出异常吗?
测试运行程序仍然会报告好像所有测试都失败了,但不要让这让您误以为它们已经运行了。 NUnit 一旦遇到异常就会有效地终止。
If I understand you correctly can't you just throw an exception somewhere in your [Setup] method or [SetupFixture] class if you encountered a failure?
The test runner will still report as if all of your tests failed, but don't let that confuse you into thinking they were run. NUnit will effectively terminate as soon as it encounters the exception.