问题
I have a very simple test!
[Test]
public void TestMethod1()
{
Assert.IsTrue(false);
}
When I try to run this with nunit3-console.exe I get the following error.
NUnit.Engine.NUnitEngineException : The NUnit 3 driver encountered an error while executing reflected code. ----> System.InvalidCastException : Unable to cast transparent proxy to type 'System.Web.UI.ICallbackEventHandler'. --NUnitEngineException
I am running .NET Core 2.1, with NUNIT Console Runner 3.9, NUnit test adapter 3.1. I did do a google search and got conflicting answers. Am I missing something?
回答1:
I reached out to NUNIT and got this answer: https://github.com/nunit/nunit-console/issues/487
NUnit Console is compiled using the full .NET Framework and does not currently support .NET Core. To run .NET Core tests from the command line, you need to use dotnet test. For info on how to do this, see https://github.com/nunit/docs/wiki/.NET-Core-and-.NET-Standard
We are looking at creating a .NET Core based console runner, but it is still in the planning stages.
回答2:
The recent release of NUnit 3.11 notes on the releases page that:
PlatformAttribute is available on .NET Standard 2.0 and now detects .NET Core
Have you tried using NUnit 3.11?
I also found this page in the NUnit Docs that talks about .NET Standard and .NET Core support. A cursory reading seems to me that it is supported.
来源:https://stackoverflow.com/questions/52835507/does-net-core-work-with-nunit-console-runner