Nick Otten
Nick Otten

Reputation: 712

Nunit-console Incorrect parameter

I'm currently trying to update some of the build nodes of our Jenkins setup from Nunit console 3.6.0 to Nunit console 3.7.0

In the old Nunit console we used via the bat call:

"E:\tools\NUnit.Console-3.6.0\nunit3-console.exe" --result="unittests.xml;format=nunit2" "some.dll" "another.dll"

With Nunit console 3.6.0 this was working. With 3.7.0 it fails on a incorrect argument (see console output below). I can't figure out witch parameter it is that is incorrect. To my knowledge all of the parameters supplied are still supported in 3.7.0

Inside the solution Nunit 3.9 is used via the NuGet package. I already tried downgrading to 3.8 but that didn't help

full log for "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)

It repeats the same error for all other dll's that where getting tested

Upvotes: 1

Views: 908

Answers (1)

Rob Prouse
Rob Prouse

Reputation: 22657

The incorrect parameter isn't an NUnit Console command line parameter, but an incorrect method parameter in the .NET Framework stack when calling AppDomain.CurrentDomain.Evidence. It is likely caused by an issue with Server 2012 where it fails to find file permissions on mapped network drives.

The simplest workaround is to move NUnit console onto a real drive, or install NUnit console as a NuGet package. To use the NuGet package, add a the NUnit.Console package to one of your test projects. When the project builds, it will be installed at $(SolutionRoot)\packages\NUnit.ConsoleRunner.3.7.0\tools\nunit3-console.exe. Just reference that copy of the Console Runner when you setup your tests. For you, probably modify your BAT file to use a relative path.

Note that the directory under packages is NUnit.ConsoleRunner not the installed package NUnit.Console. This is because NUnit.Console is a meta-package that installs the runner NUnit.ConsoleRunner and a number of extensions like support for the NUnit 2 result format which you need.

Upvotes: 1

Related Questions