【问题标题】:How to run NUnit 3.0 with Mono 4.0 runtime?如何使用 Mono 4.0 运行时运行 NUnit 3.0?
【发布时间】:2015-07-02 14:09:12
【问题描述】:

我正在尝试在 Mono 4.0 上运行使用 .NET Framework 4.5.1 构建的测试程序集,在 Windows 上运行 NUnit 3.0。

有谁知道如何让 nunit-console.exe 看到安装在我机器上的 Mono 4.0 运行时并停止说它未知或不可用?

如果我通过单声道运行 nunit-console.exe 并设置目标框架:


mono C:\Program Files (x86)\NUnit.org\bin\nunit-console.exe --framework=mono-4.0 "C:\MyTestAssembly.dll" 

NUnit Console Runner 3.0.5610
Copyright (C) 2014 Charlie Poole

Test Files
    C:\MyTestAssembly.dll

Runtime Environment
   OS Version: Microsoft Windows NT 6.3.9600.0
  CLR Version: 4.0.30319.0

Options
    ProcessModel: Default    DomainUsage: Default
    Execution Runtime: mono-4.0
    Work Directory: C:\
    Internal Trace: Off

The requested framework mono-4.0 is unknown or not available.

如果我直接运行 nunit-console.exe,不带单声道,输出是一样的:


C:\Program Files (x86)\NUnit.org\bin\nunit-console.exe --framework=mono-4.0 "C:\MyTestAssembly.dll"

如果我通过单声道运行 nunit-console.exe 但没有目标框架,输出会发生变化:


mono C:\Program Files (x86)\NUnit.org\bin\nunit-console.exe "C:\MyTestAssembly.dll" 

NUnit Console Runner 3.0.5610
Copyright (C) 2014 Charlie Poole

Test Files
    C:\MyTestAssembly.dll

Runtime Environment
   OS Version: Microsoft Windows NT 6.3.9600.0
  CLR Version: 4.0.30319.0

Options
    ProcessModel: Default    DomainUsage: Default
    Execution Runtime: Not Specified
    Work Directory: H:\Safe\Desenvolvimento\Concert\Reactive Services
    Internal Trace: Off

System.ArgumentException: The mono-4.0 framework is not available
Parameter name: framework
  at NUnit.Engine.Services.TestAgency.LaunchAgentProcess (NUnit.Engine.TestPackage package) [0x00000] in :0
  at NUnit.Engine.Services.TestAgency.CreateRemoteAgent (NUnit.Engine.TestPackage package, Int32 waitTime) [0x00000] in
:0
  at NUnit.Engine.Services.TestAgency.GetAgent (NUnit.Engine.TestPackage package, Int32 waitTime) [0x00000] in :0
  at (wrapper remoting-invoke-with-check) NUnit.Engine.Services.TestAgency:GetAgent (NUnit.Engine.TestPackage,int)
  at NUnit.Engine.Runners.ProcessRunner.LoadPackage () [0x00000] in :0

最后,如果我使用 NUnit 2.6.4 运行最后一个选项,测试会运行,但单声道进程会在最后挂起。


mono C:\Program Files (x86)\NUnit 2.6.4\bin\nunit-console.exe "C:\MyTestAssembly.dll"

如果我在没有单声道的情况下运行并且使用 NUnit 2.6.4 或 NUnit 3.0 的目标框架,则测试运行并且进程正常结束。


C:\Program Files (x86)\NUnit 2.6.4\bin\nunit-console.exe "C:\MyTestAssembly.dll"
C:\Program Files (x86)\NUnit.org\bin\nunit-console.exe "C:\MyTestAssembly.dll"

【问题讨论】:

    标签: mono nunit nunit-console


    【解决方案1】:

    您必须使用嵌入在 Mono 中的 NUnit。在控制台执行以下命令:

    cd C:\Program Files (x86)\Mono\bin
    nunit-console4 *PATH TO YOUR .Tests.dll*
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多