我在为 nunit 创建插件时遇到问题。我想我已经完成了必要的步骤,但由于某种原因,我没有在 nunit 工具插件列表中看到我创建的插件。我在 c# 中创建了一个新项目,并从我的 nunit 安装目录中引用了 nunit.core 和 nunit.core.interfaces。然后我构建它并将 dll 复制到插件目录中。
这是我的类(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
}
当我打开 nunit 时,我在插件中看不到任何东西。有什么想法可以阻止我看到这个插件并加载它。
谢谢
最佳答案
我找到了答案。显然,事件监听器没有出现在插件中,我只是运行了我的测试,它正在运行我的监听器,即使它没有出现在插件中。
关于c# - Nunit 插件没有出现在 nunit 的插件列表中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4413814/