Nunit 插件未显示在 nunit 的插件列表中
我在为 nunit 创建插件时遇到问题。我认为我已经完成了必要的步骤,但由于某种原因,我没有在 nunit 工具插件列表中看到我创建的插件。我在 c# 中创建了一个新项目,并从我的 nunit 安装目录中引用了 nunit.core 和 nunit.core.interfaces。然后我构建它并将 dll 复制到 addins 目录中。
这是我的课程:
using System;
using System.Text;
using NUnit.Core.Extensibility;
using NUnit.Core;
[NUnitAddinAttribute(Type = ExtensionType.Core, Name = "Test Addin", Description = "A test addin.")]
public class CTestingAddin : IAddin, EventListener
{
#region IAddin Members
public bool Install(IExtensionHost host)
{
IExtensionPoint listeners = host.GetExtensionPoint("EventListeners");
if (listeners == null)
return false;
listeners.Install(this);
return true;
}
#endregion
#region EventListener Members
public void RunStarted(string name, int testCount)
{
}
public void RunFinished(Exception exception)
{
}
public void RunFinished(TestResult result)
{
}
public void SuiteFinished(TestResult result)
{
}
public void SuiteStarted(TestName testName)
{
}
public void TestFinished(TestResult result)
{
}
public void TestOutput(TestOutput testOutput)
{
}
public void TestStarted(TestName testName)
{
Console.WriteLine("EVENTLISTENER: Test has started");
}
public void UnhandledException(Exception exception)
{
}
#endregion
}
当我打开 nunit 时,我在插件中看不到任何内容。有什么想法可以阻止我看到这个插件并加载它。
谢谢
I am having troubles creating an addon for nunit. I think I have done the necessary steps, but for some reason I do not see my created addon in the nunit tools addon list. I have created a new project in c# and referenced nunit.core and nunit.core.interfaces from my nunit installation directory. Then I build it and copy over the dll into the addins directory.
Here is my class:
using System;
using System.Text;
using NUnit.Core.Extensibility;
using NUnit.Core;
[NUnitAddinAttribute(Type = ExtensionType.Core, Name = "Test Addin", Description = "A test addin.")]
public class CTestingAddin : IAddin, EventListener
{
#region IAddin Members
public bool Install(IExtensionHost host)
{
IExtensionPoint listeners = host.GetExtensionPoint("EventListeners");
if (listeners == null)
return false;
listeners.Install(this);
return true;
}
#endregion
#region EventListener Members
public void RunStarted(string name, int testCount)
{
}
public void RunFinished(Exception exception)
{
}
public void RunFinished(TestResult result)
{
}
public void SuiteFinished(TestResult result)
{
}
public void SuiteStarted(TestName testName)
{
}
public void TestFinished(TestResult result)
{
}
public void TestOutput(TestOutput testOutput)
{
}
public void TestStarted(TestName testName)
{
Console.WriteLine("EVENTLISTENER: Test has started");
}
public void UnhandledException(Exception exception)
{
}
#endregion
}
I don't see anything in the addons when I open up nunit. Any ideas what could keep me from seeing this addon and getting it loaded.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了答案。显然事件监听器没有出现在插件中,我刚刚运行了测试,它正在运行我的监听器,即使它没有出现在插件中。
I found my answer. Apparently the eventlistener doesn't show up in the addons, I just ran my test and it was running my listener even though it wasn't showing up on the addons.