原NUnit測試用例在升級為.NET Core之前是可以正常運行的,
升級後,在VS.NET下可以正常運行,但到了TeamCity下報異常:
[08:46:58][Step 5/5] NUnit.Engine.NUnitEngineException : An exception occurred in the driver while loading tests.
[08:46:58][Step 5/5] ----> System.IO.FileNotFoundException : 未能加载文件或程序集“nunit.framework”或它的某一个依赖项。系统找不到指定的文件。
[08:46:58][Step 5/5] --NUnitEngineException
[08:46:58][Step 5/5]
[08:46:58][Step 5/5] Server stack trace:
[08:46:58][Step 5/5] 在 NUnit.Engine.Runners.DirectTestRunner.LoadDriver(IFrameworkDriver driver, String testFile, TestPackage subPackage)
[08:46:58][Step 5/5] 在 NUnit.Engine.Runners.DirectTestRunner.LoadPackage()
[08:46:58][Step 5/5] 在 NUnit.Engine.Runners.TestDomainRunner.LoadPackage()
[08:46:58][Step 5/5] 在 NUnit.Engine.Runners.DirectTestRunner.EnsurePackageIsLoaded()
[08:46:58][Step 5/5] 在 NUnit.Engine.Runners.DirectTestRunner.RunTests(ITestEventListener listener, TestFilter filter)
[08:46:58][Step 5/5] 在 NUnit.Engine.Runners.AbstractTestRunner.Run(ITestEventListener listener, TestFilter filter)
[08:46:58][Step 5/5] 在 NUnit.Engine.Agents.RemoteTestAgent.Run(ITestEventListener listener, TestFilter filter)
[08:46:58][Step 5/5] 在 System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
[08:46:58][Step 5/5] 在 System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Object[]& outArgs)
[08:46:58][Step 5/5] 在 System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
[08:46:58][Step 5/5]
[08:46:58][Step 5/5] Exception rethrown at [0]:
[08:46:58][Step 5/5] 在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
[08:46:58][Step 5/5] 在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
[08:46:58][Step 5/5] 在 NUnit.Engine.ITestEngineRunner.Run(ITestEventListener listener, TestFilter filter)
[08:46:58][Step 5/5] 在 NUnit.Engine.Runners.ProcessRunner.RunTests(ITestEventListener listener, TestFilter filter)
修改 NUnit Console 版本,繼續異常,但異常不同:
[09:09:51][Step 5/5] An exception occurred in the driver while loading tests.
[09:09:51][Step 5/5]
[09:09:51][Step 5/5] Server stack trace:
[09:09:51][Step 5/5] 在 NUnit.Engine.Runners.DirectTestRunner.LoadDriver(IFrameworkDriver driver, String testFile, TestPackage subPackage)
[09:09:51][Step 5/5] 在 NUnit.Engine.Runners.DirectTestRunner.LoadPackage()
[09:09:51][Step 5/5] 在 NUnit.Engine.Runners.TestDomainRunner.LoadPackage()
[09:09:51][Step 5/5] 在 NUnit.Engine.Runners.DirectTestRunner.EnsurePackageIsLoaded()
[09:09:51][Step 5/5] 在 NUnit.Engine.Runners.DirectTestRunner.RunTests(ITestEventListener listener, TestFilter filter)
[09:09:51][Step 5/5] 在 NUnit.Engine.Runners.AbstractTestRunner.Run(ITestEventListener listener, TestFilter filter)
[09:09:51][Step 5/5] 在 NUnit.Engine.Agents.RemoteTestAgent.Run(ITestEventListener listener, TestFilter filter)
[09:09:51][Step 5/5] 在 System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
[09:09:51][Step 5/5] 在 System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Object[]& outArgs)
[09:09:51][Step 5/5] 在 System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
[09:09:51][Step 5/5]
[09:09:51][Step 5/5] Exception rethrown at [0]:
[09:09:51][Step 5/5] 在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
[09:09:51][Step 5/5] 在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
[09:09:51][Step 5/5] 在 NUnit.Engine.ITestEngineRunner.Run(ITestEventListener listener, TestFilter filter)
[09:09:51][Step 5/5] 在 NUnit.Engine.Runners.ProcessRunner.RunTests(ITestEventListener listener, TestFilter filter)
[09:09:51][Step 5/5]
[09:09:51][Step 5/5] Test Run Summary
[09:09:51][Step 5/5] Overall result: Failed
[09:09:51][Step 5/5] Test Count: 0, Passed: 0, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
[09:09:51][Step 5/5] Start time: 2018-08-17 01:09:47Z
[09:09:51][Step 5/5] End time: 2018-08-17 01:09:51Z
[09:09:51][Step 5/5] Duration: 3.566 seconds
檢查項目中版本:
官網NUnit Console版本:
引用降級為v3.8.0,TeamCity異常:NU1605: Detected package downgrade: NUnit from 3.10.1 to 3.8.0. Reference the package directly from the project to select a different version.