Search code examples
.netlinuxnunit-console

Can I run nunit3-console directly on Linux as a .NET 6 app or is it just compatible with .NET 6 test assemblies?


We've been using Mono for years to run our .NET app. We've recently started building using .NET 6, which allows it to run directly without Mono. NUnit.ConsoleRunner.3.15.2 supports .NET 6. I'm wondering if that means I can run nunit3-console without Mono too or does it just mean that it supports running my .NET 6 test assemblies, but I still need to use Mono? I'm using dotnet test to run the tests, but dotnet doesn't list tests, which is why I'm using nunit3-console.exe with the --explore option. The goal is to get rid of Mono.

The command looks like this:

nunit3-console.exe --noheader --where:"cat == LongRunning" MyAssembly.Tests.dll --explore

It works on Windows, but not Linux. I tried with and without the .exe. The error is:

bash: /trunk/Tools/Build/NUnit3/NUnit.ConsoleRunner.3.15.2/tools/nunit3-console.exe: cannot execute binary file

or

bash: /trunk/Tools/Build/NUnit3/NUnit.ConsoleRunner.3.15.2/tools/nunit3-console: No such file or directory


Solution

  • I'm now using nunit3-dotnet-console.dll 3.16.3 and it works like this:

    dotnet nunit3-dotnet-console.dll --explore MyTests.dll

    It's working on Windows and Linux.