NUNIT 忽略了我的测试? 为什么?
我有一个非常简单的测试类,如下所示。
由于某种原因,我的测试被 GUI 忽略并显示为黄色。
我已将框架和运行器更新到 2.4.8,因为我认为版本之间的差异可能是问题所在。
using System;
using NUnit.Framework;
namespace TestRunner
{
[TestFixture]
class TestMe
{
[Test]
public void TestBob()
{
Assert.IsTrue(true);
}
}
}
I Have a really simple test class as below.
For some reason my test is being ignored by the GUI and coming up yellow.
I have updated the framework and runner to 2.4.8 as I thought it might have been differences between versions being the problem.
using System;
using NUnit.Framework;
namespace TestRunner
{
[TestFixture]
class TestMe
{
[Test]
public void TestBob()
{
Assert.IsTrue(true);
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的 TestMe 类需要公开。
以下是一些关于标记为的类的要求的文档 TestFixture 属性讨论类可能不被识别为测试装置的条件。
Your TestMe class needs to be public.
Here is some documentation on the requirements for classes marked with the TestFixture attribute that discusses the conditions under which a class may not be recognized as a test fixture.
您没有为您的类指定访问修饰符; 因此,默认情况下,您的类是内部类,并且 NUnit 看不到您的类。
如果您为包含测试的类指定公共访问修饰符,那么它应该可以正常工作:
You didn't specify an access modifier for your class; therefore, your class is internal by default and NUnit does not see your class.
If you specify the public access modifier for your class that contains the Tests, then it should just work: