如何使用Mono 4.0运行时运行NUnit 3.0?

时间:2015-07-02 14:09:13

标签: mono nunit nunit-console

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

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

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

display.configure(text=("Bicycle", x, "was used", a[x], "times."))

如果我直接运行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.

如果我通过mono运行nunit-console.exe但没有目标框架,则输出会更改:


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

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


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或NUnit 3.0运行没有mono和目标框架,测试运行并且过程正常结束。


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

1 个答案:

答案 0 :(得分:1)

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

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