如何在Mono 4.0运行时下运行NUnit 3.0?

4
我正在尝试在Windows上使用Mono 4.0和NUnit 3.0运行使用.NET Framework 4.5.1构建的测试装配件。你知道怎样让nunit-console.exe看到我机器上已安装的Mono 4.0运行库并停止显示未知或不可用的信息吗?如果我通过mono运行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,而没有使用mono,输出结果是相同的。

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

如果我通过mono运行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 进程在结束时会挂起。


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

如果我在不使用Mono和目标框架的情况下使用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"
1个回答

1

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

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接