Does .NET Core work with NUNIT console runner?

痞子三分冷 提交于 2020-02-04 02:01:27

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!