【问题标题】:NUnit failed to load, using version 3.11NUnit 加载失败,使用版本 3.11
【发布时间】:2019-08-04 11:30:18
【问题描述】:

当我降低到 3.10 时,它可以工作,但不确定为什么它会因为最新而停止。我尝试的一切都不起作用。

这是输出中显示的内容。我尝试了许多在网上找到的选项,但似乎没有任何帮助:

[13/03/2019 17:10:44 Informational] ------ Run test started ------
[13/03/2019 17:10:45 Informational] NUnit Adapter 3.13.0.0: Test execution started
[13/03/2019 17:10:45 Informational] Running all tests in E:\xxx\xxx\xxx.Tests\bin\Debug\xxx.Tests.dll
[13/03/2019 17:10:45 Informational]    NUnit failed to load E:\xxx\xxx\xxx.xxx\bin\Debug\xxx.Tests.dll
[13/03/2019 17:10:45 Informational] NUnit Adapter 3.13.0.0: Test execution complete
[13/03/2019 17:10:45 Warning] No test matches the given testcase filter `FullyQualifiedName=xxx.xxx.xxxTestss.xxxxnameshouldbesomething` in E:\xxx\xxx\xxx.Tests\bin\Debug\xxx.Tests.dll
[13/03/2019 17:10:45 Informational] ========== Run test finished: 0 run (0:00:01.6716706) ==========

我在这里也创建了一个基本测试来确认:

Imports NUnit.Framework
Imports Should

<TestFixture()>
Public Class UnitTest1

    <Test()> Public Sub TestMethod1()
        Dim b As Boolean = False
        b.ShouldBeFalse
    End Sub

End Class

我尝试删除 TestFixture,将其重命名为 TestClass(但我需要使用 NUnit!)

太奇怪了...解决方案中的一个项目确实有效,但我找不到任何区别。

我什至尝试创建一个新的空项目...但这甚至不适用于任何版本的 NUnit(但我想我将把它作为一个单独的问题提出)。

【问题讨论】:

    标签: visual-studio unit-testing nuget nunit nunit-3.0


    【解决方案1】:

    问题发现,出于某种原因,我的项目的 Microsoft.VisualStudio.QualityTools.UnitTestFramework 标志“复制本地”设置为 false。

    当我将其更改为 true 时,我的测试现在正在启动并运行:)

    3.10版似乎不需要这个,这就是为什么在降低版本时,它又开始工作了。

    (我认为设置此标志不会影响本地运行)

    【讨论】:

    • 我在使用 NUnit 3.12 时遇到了类似的问题。这面旗帜在哪里?
    • @akarnokd 抱歉,刚刚看到这个...当您在解决方案资源管理器中单击“属性”底部的引用时,您应该会看到此标志
    • 这个也帮了我。谢谢!
    • 它对我有用,但我想知道为什么 Microsoft.VisualStudio.QualityTools.UnitTestFramework 需要“复制本地”。它与 NUnit 有什么关系?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-05
    • 2015-03-06
    • 1970-01-01
    • 2016-05-03
    • 2015-02-27
    • 2011-10-29
    相关资源
    最近更新 更多