如果 NUnit 中其中一个测试失败,如何停止 TestFixture 中测试的进一步执行?
如果其中一个测试在 NUnit 中失败,我想停止在 TestFixture 中进一步执行测试。
当然,常见且建议的做法是使测试彼此独立。然而,我想使用 NUnit 的情况要求不执行失败的测试和测试装置。换句话说,测试失败会导致整个 NUnit 执行停止(或继续执行下一个 [TestFixture],但这两种情况都应该是可配置的)。
简单但不可接受的解决方案是通过向 NUnit 进程发送某种信号来强制 NUnit 终止。
有没有办法以优雅的方式做到这一点?
I want to stop further execution of Tests within a TestFixture if one of them fails in NUnit.
Of course the common and advised practice is to make tests independent of each other. However, the case I would like to use NUnit for, requires that all tests and test fixtures following one that failed, are not executed. In other words, test failure causes the whole NUnit execution to stop (or proceeds with the next [TestFixture] but both scenarios should be configurable).
The simple, yet not acceptable solution, would be to force NUnit termination by sending a signal of some kind to the NUnit process.
Is there a way to do this in an elegant way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您可以使用 NAnt 来执行此操作。具体来说, nunit 或 nunit2 任务有一个
haltonfailure
参数,允许测试运行在以下情况下停止:测试失败。I believe you can use NAnt to do this. Specifically, the nunit or nunit2 tasks have a
haltonfailure
parameter that allows the test run to stop if a test fails.