0

I have successfully converted a testing solution from .NET 4.6.1 to .NET Core 3.1. Within the solution I reference NUnit.Console 3.12.0, NUnit.ConsoleRunner 3.12.0, NUnit.Engine 3.12.0, and NUnit3TestAdapter 3.17.0. All the latest stable bits. When running the tests within Visual Studio, all is well.

My challenge is when I use .\.nuget\packages\nunit.consolerunner\3.12.0\tools\nunit3-console.exe <reference to my .NET Core 3.1 test csproj> to execute the tests. I am getting an exception that is discribed here: The NUnit 3 driver encountered an error while executing reflected code (NUnit.Engine.NUnitEngineException). According to http://charliepoole.org/technical/nunit-engine-version-conflicts-in-visual-studio.html I should be paying attention to the versions of NUnit. I have changed my NUnit references to NUnit.Console 3.11.1, NUnit.ConsoleRunner 3.11.1, NUnit.Engine 3.11.1, and NUnit3TestAdapter 3.17.0. When using .\.nuget\packages\nunit.consolerunner\3.11.1\tools\nunit3-console.exe <reference to my .NET Core 3.1 test csproj> I am still getting the exception listed earlier. I changed my csproj version to be netstandard2.0 to see what happens; no luck getting NUnit executable to successfully run.

I did obtain the zipped folder of the NUnit solution. When using .\.nunit-console-3.12\bin\Debug\netcoreapp3.1\nunit3-console.exe <reference to my .NET Core 3.1 test csproj> no problems - all is well. So obviously I am doing something incorrectly since locally compile version works but NuGet version does not.

I need to use the NuGet installed version since that is what the build server will use to execute the tests. Ideas and/or suggestions on what I am doing incorrectly?

  • `nunit3-console.exe` doesn't support .net core tests (yet?), according to https://stackoverflow.com/questions/52835507/does-net-core-work-with-the-nunit-console-runner . From [TeamCity NUnit runners support](https://www.jetbrains.com/help/teamcity/nunit-support.html#Framework+Compatibility) options to run .net Core NUnit tests from command line are `dotnet test` , `dotnet msbuild /t:VSTest` , `dotnet vstest` – Renat Feb 26 '21 at 15:51
  • I did not see those posts. Hmft! – Gerald Bauer Feb 26 '21 at 16:15
  • 1
    https://www.nuget.org/packages/NUnit.ConsoleRunner.NetCore/3.12.0-beta2 <--this is the Beta version of the .NET Core Console Runner, if you wanted to give it a try. There's some known issues around dependency loading however. – Chris Feb 26 '21 at 17:16
  • Great news @Chris. I can only do this as a POC (proof of concept) since this is beta. Is there a site I can watch to learn when this becomes a production? – Gerald Bauer Mar 01 '21 at 13:22

0 Answers0