Nunit 插件未显示在 nunit 的插件列表中

发布于 2024-10-06 18:40:23 字数 1496 浏览 5 评论 0原文

我在为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧人九事 2024-10-13 18:40:23

我找到了答案。显然事件监听器没有出现在插件中,我刚刚运行了测试,它正在运行我的监听器,即使它没有出现在插件中。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文