NUnit 在汇编中找不到测试
我用 MSTest 继承了一个程序集,但这些测试是在构建机器上使用 nunit-console 运行的(不确定它是如何工作的)。 所以我决定对其进行整理并将其更改为适当的 NUnit 测试,但现在 nunit-console (或 gui)找不到任何测试。 不过,使用 ReSharper 测试运行器它们运行得很好。 知道可能缺少什么吗?
I inherited an assembly with MSTest, but these tests were run using nunit-console on the build machine (not sure how it worked). So I decided to sort it out and change them to proper NUnit tests, but now nunit-console (or gui) can't find any tests. They run just fine using ReSharper test runner though. Any idea what could be missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
检查:
[TestFixture]
属性?[Test]
属性?我相信 NUnit 的某些版本能够根据名称找到测试,例如没有
[Test]
属性的TestFooBarBaz()
,但我不知道现在的情况如何——但这可以解释这种差异。Check:
[TestFixture]
attribute at the class level?[Test]
attribute?I believe some versions of NUnit were able to find tests based on their names, e.g.
TestFooBarBaz()
without the[Test]
attribute, but I don't know what the state of this is now - it could explain the discrepancy though.谢谢大家的帮助。 升级到最新的 NUnit 框架解决了这个问题(您建议的所有明显的事情都可以)。
Frederik Gheysels,我想你也可以尝试一下。
Thanks for help, everyone. Upgrading to the latest NUnit framework fixed the problem (all the obvious things you suggested were OK).
Frederik Gheysels, you can try that as well I guess.
您的测试装置、类和方法是公开的吗? 它们必须是 NUnit 才能找到的。
Are your test fixtures, classes and methods, public? They have to be for NUnit to find them.