2

我们使用 NUnit 进行单元测试,使用 TeamCity 作为我们的 CI 服务器。每次提交后,所有测试都在执行。如果某些测试失败,则会发送电子邮件通知。

一切顺利,但今天我注意到许多测试被忽略了。我还看到了描述原因的消息:

MyApplicationTests 中的 TestFixtureSetUp 失败

我很困惑为什么这些测试被忽略但没有失败。我担心的是开发人员认为一切进展顺利,但实际上测试没有运行(忽略)。

问题:如果 TestFixtureSetUp 失败,如何配置 NUnit 以失败测试(而不是忽略)?

如果测试被忽略,也许我们可以配置 TeamCity 发送电子邮件通知。但这不是我想要的,因为我们有一些标有Ignore属性的测试。因此每次都会发送通知并且变得无用。

4

1 回答 1

0

TeamCity cannot filter this event and report it differently to you. There seems to be no way of programmatically failing all the tests in a fixture from the TestFixtureSetUp callback.

So, in my opinion, you have no chance but closely monitoring the Ignores in your build results. There seems to be no automatic way of distinguishing them from the tests you actually are ignoring.

As a side note, whenever I or my colleagues marked tests with the Ignore attribute (in my career) it was never temporary. Always permanent. We should use the Ignore flag very carefully, in my opinion.

于 2013-09-18T06:09:15.093 回答