unit-testing - 使用与不使用 TestFixture 属性有什么区别

标签 unit-testing nunit installation

对于具有 TestFixture 的类,我看不到任何行为差异。属性而不是。全部 TearDownSetUp以同样的方式工作。除了语义之外,这个属性使用还有什么原因吗?

最佳答案

纯粹是为了方便,从 NUnit 2.5 开始,如果一个类满足成为测试夹具的条件,并且至少指定了一个标记为 Test 的方法, TestCaseTestCaseSource而不是该类被视为测试夹具。
TestFixture但是,参数化或通用测试装置需要属性,因为在这种情况下,您还可以通过属性(参数/具体类型)指定其他信息。

有关特定要求的更多信息,请访问 TextFixtureAttribute (NUnit 3 Documentation)
TestFixtureAttribute (NUnit 2.0 / 2.5)

关于unit-testing - 使用与不使用 TestFixture 属性有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8400873/

相关文章:

c# - 如何使用 "dotnet test"按类别过滤 NUnit 测试

java - 无法在 R ubuntu 12.04 中安装 intamap 包(涉及 java)

unit-testing - 在 go 中测试连接的正确方法

ruby-on-rails - 除了 heckle,Ruby 的代码修改器?

c# - TestServer返回404未找到

mysql - WordPress 在 wp-config 中否定 DB_COLLATE

python - 如何安装带有诗歌的 python 包?

unit-testing - 如何从 Visual Studio 2017 netcore 环境中删除恶意 NUnit 测试适配器?

java - 无法从我的 JUnit 测试中设置集群 Vert.x 环境

.net - 另一个 "could not load file or assembly ... or one of its dependencies. The system cannot find the file specified"