目前我正在尝试使用NUnit在xml文件中获取测试结果。 我正在使用的以下命令是:
nunit3-console.exe --labels=All --out=TestResult.txt "--result=TestResult.xml;format=nunit3" "Acceptance Tests\AcceptanceTests.dll" --trace:Debug
然后在生成的文件“TestResult.xml”中,我有测试运行元素
testcasecount="1" result="Failed" label="Error" total="1" passed="0" failed="1" inconclusive="0" skipped="0" asserts="0" engine-version="3.7.0.0" clr-version="4.0.30319.42000"
然后即将失败,例外情况为:
<failure>
<message><![CDATA[An exception occurred in the driver while loading tests.]]></message>
<stack-trace><![CDATA[
Server stack trace:
at NUnit.Engine.Runners.DirectTestRunner.LoadDriver(IFrameworkDriver driver, String testFile, TestPackage subPackage)
at NUnit.Engine.Runners.DirectTestRunner.LoadPackage()
at NUnit.Engine.Runners.DirectTestRunner.EnsurePackageIsLoaded()
at NUnit.Engine.Runners.DirectTestRunner.RunTests(ITestEventListener listener, TestFilter filter)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at NUnit.Engine.ITestEngineRunner.Run(ITestEventListener listener, TestFilter filter)
at NUnit.Engine.Runners.ProcessRunner.RunTests(ITestEventListener listener, TestFilter filter)]]></stack-trace>
</failure>
项目中已安装的软件包包括:“NUnit”,“NUnit.Console”,“NUnit.ConsoleRunner”,“NUnit.Runners”,“NUnit3TestAdapter”
提前致谢
答案 0 :(得分:1)
nunit-console目前无法运行.NET Core程序集。
您需要使用NUnit3TestAdapter,然后通过dotnet test
运行。
有关详细信息,请参阅此处的文档:https://github.com/nunit/docs/wiki/.NET-Core-and-.NET-Standard
目前我正在尝试使用NUnit在xml文件中获取测试结果。
不幸的是,这还不适用于.NET Core。但是,有一个opn功能请求,您可以通过以下链接进行跟踪。欢迎提出请求!