4

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

有谁知道如何让 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"
4

1 回答 1

1

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

cd C:\Program Files (x86)\Mono\bin
nunit-console4 *PATH TO YOUR .Tests.dll*
于 2016-07-19T08:31:11.223 回答