NUnit:如果没有执行断言,是否可以配置测试失败的 NUnit
NUnit: Is it possible to configure NUnit that a Test fails, if no Assert has executed
我正在使用 NUnit。是否有可能以某种方式配置 NUnit,以便每个 UnitTest 都失败,但至少不会调用一次 Assert-Method?
所以我可以防止一些无效单元测试的情况。
基于此 discussion 看来不可能。不可否认,这是 3 年前的事,但我认为答案没有改变。
Stated simply, there's no setting such as you are looking for. I
recall that we discussed the possibility a long time ago on the old
SourceForge mailing list and that the general opinion at the time was
for an empty test to simply succeed. One reason is that some people
were writing tests in which all the Asserts were conditional and
didn't want to see a failure if none were applicable. Of course, the biggest reason is that NUnit is oriented toward TDD, even if not
exclusively. So the general community of users does not usually have a
bunch of empty tests.
创建了一个 'bug' 用于添加对命令行选项的支持以启用此功能,但自 2013 年以来它似乎没有任何 activity。我在 nUnit 上看不到任何相应的问题Github 虽然。
我正在使用 NUnit。是否有可能以某种方式配置 NUnit,以便每个 UnitTest 都失败,但至少不会调用一次 Assert-Method?
所以我可以防止一些无效单元测试的情况。
基于此 discussion 看来不可能。不可否认,这是 3 年前的事,但我认为答案没有改变。
Stated simply, there's no setting such as you are looking for. I recall that we discussed the possibility a long time ago on the old SourceForge mailing list and that the general opinion at the time was for an empty test to simply succeed. One reason is that some people were writing tests in which all the Asserts were conditional and didn't want to see a failure if none were applicable. Of course, the biggest reason is that NUnit is oriented toward TDD, even if not exclusively. So the general community of users does not usually have a bunch of empty tests.
创建了一个 'bug' 用于添加对命令行选项的支持以启用此功能,但自 2013 年以来它似乎没有任何 activity。我在 nUnit 上看不到任何相应的问题Github 虽然。