Rafael Romão
Rafael Romão

Reputation: 1798

How to run NUnit 3.0 with Mono 4.0 runtime?

I'm trying to run a test assembly built with .NET Framework 4.5.1 on Mono 4.0 and NUnit 3.0 on Windows.

Does anyone know how to make nunit-console.exe see the Mono 4.0 runtime that is installed on my machine and stop saying it is unknown or not available?

If I run nunit-console.exe through mono and set the target framework:


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.

If I run nunit-console.exe directly, without mono, the output is the same:


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

If I run nunit-console.exe through mono but without the target framework, the output changes:


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

And finally, if I run the last option using NUnit 2.6.4, the test runs but the mono process hangs at the end.


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

And if I run without mono and the target framework using NUnit 2.6.4 or NUnit 3.0, the test runs and the process ends normally.


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"

Upvotes: 4

Views: 1220

Answers (1)

desperate man
desperate man

Reputation: 904

You have to use NUnit embedded in Mono. Execute the following commands in console:

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

Upvotes: 1

Related Questions