我目前正在尝试将我们的Jenkins设置的一些构建节点从Nunit console 3.6.0更新到Nunit控制台3.7.0
在我们通过蝙蝠呼叫使用的旧Nunit控制台中:
"E:\tools\NUnit.Console-3.6.0\nunit3-console.exe" --result="unittests.xml;format=nunit2" "some.dll" "another.dll"
使用Nunit console 3.6.0,这是有效的。使用3.7.0时,它会在不正确的参数上失败(请参阅下面的控制台输出)。我无法弄清楚巫婆参数是不正确的。据我所知,3.7.0仍然支持所有提供的参数
在解决方案中,Nunit 3.9通过NuGet包使用。我已经尝试降级到3.8,但这没有帮助
"E:\tools\NUnit.Console-3.7.0\nunit3-console.exe" --result="unittests.xml;format=nunit2" [list of dll's]
的完整日志:
14:04:18 NUnit Console Runner 3.7.0
14:04:18 Copyright (c) 2017 Charlie Poole, Rob Prouse
14:04:18
14:04:19 Runtime Environment
14:04:19 OS Version: Microsoft Windows NT 6.3.9600.0
14:04:19 CLR Version: 4.0.30319.42000
14:04:19
14:04:19 Test Files
14:04:19 EplanImporterTests\bin\Debug\EplanImporterTests.dll
14:04:19 MachineConfiguratorTests\bin\Debug\MachineConfiguratorTests.dll
14:04:19 TSMFileGeneratorTests\bin\Debug\TSMFileGeneratorTests.dll
14:04:19 TsmBlockTypesTests\bin\Debug\TsmBlockTypesTests.dll
14:04:19 ValidationFrameworkTests\bin\Debug\EplanImporterTests.dll
14:04:19 ValidationFrameworkTests\bin\Debug\TSMFileGeneratorTests.dll
14:04:19 ValidationFrameworkTests\bin\Debug\ValidationFrameworkTests.dll
14:04:19 ValidatorFrameworkTests\bin\Debug\ValidatorFrameworkTests.dll
14:04:19
14:04:23
14:04:23 Errors, Failures and Warnings
14:04:23
14:04:23 1) Error : E:\DEV-BLD-SVR02\workspace\NunitUpdateedbae018\EplanImporterTests\bin\Debug\EplanImporterTests.dll
14:04:23 The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
14:04:23
14:04:23 Server stack trace:
14:04:23 at System.Security.Policy.PEFileEvidenceFactory.GetLocationEvidence(SafePEFileHandle peFile, SecurityZone& zone, StringHandleOnStack retUrl)
14:04:23 at System.Security.Policy.PEFileEvidenceFactory.GenerateLocationEvidence()
14:04:23 at System.Security.Policy.PEFileEvidenceFactory.GenerateEvidence(Type evidenceType)
14:04:23 at System.Security.Policy.AssemblyEvidenceFactory.GenerateEvidence(Type evidenceType)
14:04:23 at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type)
14:04:23 at System.Security.Policy.Evidence.GetHostEvidence(Type type, Boolean markDelayEvaluatedEvidenceUsed)
14:04:23 at System.Security.Policy.AppDomainEvidenceFactory.GenerateEvidence(Type evidenceType)
14:04:23 at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type)
14:04:23 at System.Security.Policy.Evidence.RawEvidenceEnumerator.MoveNext()
14:04:23 at System.Security.Policy.Evidence.EvidenceEnumerator.MoveNext()
14:04:23 at System.Security.Policy.Evidence.get_Count()
14:04:23 at NUnit.Engine.Services.DomainManager.CreateDomain(TestPackage package)
14:04:23 at NUnit.Engine.Runners.TestDomainRunner.LoadPackage()
14:04:23 at NUnit.Engine.Runners.DirectTestRunner.EnsurePackageIsLoaded()
14:04:23 at NUnit.Engine.Runners.DirectTestRunner.RunTests(ITestEventListener listener, TestFilter filter)
14:04:23 at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
14:04:23 at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
14:04:23
14:04:23 Exception rethrown at [0]:
14:04:23 at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
14:04:23 at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
14:04:23 at NUnit.Engine.ITestEngineRunner.Run(ITestEventListener listener, TestFilter filter)
14:04:23 at NUnit.Engine.Runners.ProcessRunner.RunTests(ITestEventListener listener, TestFilter filter)
对于进行测试的所有其他dll,它会重复相同的错误
答案 0 :(得分:1)
不正确的参数不是NUnit控制台命令行参数,而是在调用AppDomain.CurrentDomain.Evidence
时.NET Framework堆栈中的方法参数不正确。它可能是由issue with Server 2012引起的,它无法在映射的网络驱动器上找到文件权限。
最简单的解决方法是将NUnit控制台移动到真实驱动器上,或者将NUnit控制台安装为NuGet包。要使用NuGet包,请将NUnit.Console包添加到您的某个测试项目中。项目构建时,它将安装在$(SolutionRoot)\packages\NUnit.ConsoleRunner.3.7.0\tools\nunit3-console.exe
。在设置测试时,只需引用控制台运行程序的副本即可。对于您,可能会修改您的BAT文件以使用相对路径。
请注意,软件包下的目录是NUnit.ConsoleRunner
而不是已安装的软件包NUnit.Console
。这是因为NUnit.Console
是一个元数据包,用于安装运行器NUnit.ConsoleRunner
和一些扩展,例如支持您需要的NUnit 2结果格式。