NUnit runner

I have c# project targeting .net core 2.1 with unit tests. Project references NUnit 3.9.0 (tried 3.10.1 - same result) via NuGet. TeamCity Professional 2018.1.2 (build 58537), With NuGet 4.8.1, NUnit Console 3.9.0. .Net Framework 4.6.1, .Net Core 2.1 SDK installed. Test run step failed with log:

[17:41:13]
[Step 3/3] The TeamCity NUnit runner requires the following NUnit extensions to be installed: NUnit.Engine.Listeners.TeamCityEventListener, NUnit.Engine.Services.ProjectLoaders.NUnitProjectLoader. Please follow our instructions at: https://confluence.jetbrains.com/display/TCDL/NUnit#NUnit-NUnit3Extensions
[17:41:13]
[Step 3/3] Starting: C:\TeamCity\buildAgent\tools\JetBrains.dotCover.CommandLineTools.bundled\dotCover.exe cover C:\TeamCity\buildAgent\temp\buildTmp\HELJrxvu9vkC4PHGumCy3M7Fu3HJTHS1.dotCover /ReturnTargetExitCode /NoCheckForUpdates
[17:41:13]
[Step 3/3] in directory: C:\TeamCity\buildAgent\work\3a7afe7f3c23d3f5\Registry\EnterRegistry.Server.Tests\bin\Release\netcoreapp2.1
[17:41:13]
[Step 3/3] JetBrains dotCover Console Runner 2018.1.2. Build 112.0.20180530.115319
[17:41:13]
[Step 3/3] Copyright (c) 2009-2018 JetBrains s.r.o. All rights reserved.
[17:41:13]
[Step 3/3] [JetBrains dotCover] Coverage session started [21.09.2018 17:41:13]
[17:41:14]
[Step 3/3] Runtime Environment
[17:41:14]
[Step 3/3]    OS Version: Microsoft Windows NT 6.3.9600.0
[17:41:14]
[Step 3/3]   CLR Version: 4.0.30319.42000
[17:41:14]
[Step 3/3]
[17:41:14]
[Step 3/3] Test Files
[17:41:14]
[Step 3/3]     C:\TeamCity\buildAgent\temp\buildTmp\5odslwpfTvL3TS4UZeXY6FGzRiir5Zax.nunit
[17:41:14]
[Step 3/3]
[17:41:15]
[Step 3/3]
[17:41:15]
[Step 3/3] Errors, Failures and Warnings
[17:41:15]
[Step 3/3]
[17:41:15]
[Step 3/3] 1) Error : C:\TeamCity\buildAgent\temp\buildTmp\5odslwpfTvL3TS4UZeXY6FGzRiir5Zax.nunit
[17:41:15]
[Step 3/3] NUnit.Engine.NUnitEngineException : An exception occurred in the driver while loading tests.
[17:41:15]
[Step 3/3]   ----> System.IO.FileNotFoundException : ЌҐ г¤ «®бм § Јаг§Ёвм д ©« Ё«Ё бЎ®аЄг "nunit.framework, Version=3.9.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb" «ЁЎ® ®¤­г Ё§ Ёе § ўЁбЁ¬®б⥩. ЌҐ г¤ Ґвбп ­ ©вЁ гЄ § ­­л© д ©«.
[17:41:15]
[Step 3/3] --NUnitEngineException
[17:41:15]
[Step 3/3] An exception occurred in the driver while loading tests.
[17:41:15]
[Step 3/3]
[17:41:15]
[Step 3/3] Server stack trace:
[17:41:15]
[Step 3/3]    ў NUnit.Engine.Runners.DirectTestRunner.LoadDriver(IFrameworkDriver driver, String testFile, TestPackage subPackage)
[17:41:15]
[Step 3/3]    ў NUnit.Engine.Runners.DirectTestRunner.LoadPackage()
[17:41:15]
[Step 3/3]    ў NUnit.Engine.Runners.TestDomainRunner.LoadPackage()
[17:41:15]
[Step 3/3]    ў NUnit.Engine.Runners.DirectTestRunner.EnsurePackageIsLoaded()
[17:41:15]
[Step 3/3]    ў NUnit.Engine.Runners.DirectTestRunner.RunTests(ITestEventListener listener, TestFilter filter)
[17:41:15]
[Step 3/3]    ў NUnit.Engine.Runners.AbstractTestRunner.Run(ITestEventListener listener, TestFilter filter)
[17:41:15]
[Step 3/3]    ў NUnit.Engine.Agents.RemoteTestAgent.Run(ITestEventListener listener, TestFilter filter)
[17:41:15]
[Step 3/3]    ў System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
[17:41:15]
[Step 3/3]    ў System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
[17:41:15]
[Step 3/3]
[17:41:15]
[Step 3/3] Exception rethrown at [0]:
[17:41:15]
[Step 3/3]    ў System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
[17:41:15]
[Step 3/3]    ў System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
[17:41:15]
[Step 3/3]    ў NUnit.Engine.ITestEngineRunner.Run(ITestEventListener listener, TestFilter filter)
[17:41:15]
[Step 3/3]    ў NUnit.Engine.Runners.ProcessRunner.RunTests(ITestEventListener listener, TestFilter filter)
[17:41:15]
[Step 3/3] --
[17:41:15]
[Step 3/3] FileNotFoundException
[17:41:15]
[Step 3/3] ЌҐ г¤ «®бм § Јаг§Ёвм д ©« Ё«Ё бЎ®аЄг "nunit.framework, Version=3.9.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb" «ЁЎ® ®¤­г Ё§ Ёе § ўЁбЁ¬®б⥩. ЌҐ г¤ Ґвбп ­ ©вЁ гЄ § ­­л© д ©«.
[17:41:15]
[Step 3/3]    ў System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
[17:41:15]
[Step 3/3]    ў System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
[17:41:15]
[Step 3/3]    ў System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
[17:41:15]
[Step 3/3]    ў System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
[17:41:15]
[Step 3/3]    ў System.AppDomain.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
[17:41:15]
[Step 3/3]    ў System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
[17:41:15]
[Step 3/3]    ў System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
[17:41:15]
[Step 3/3]    ў NUnit.Engine.Drivers.NUnit3FrameworkDriver.CreateObject(String typeName, Object[] args)
[17:41:15]
[Step 3/3]    ў NUnit.Engine.Drivers.NUnit3FrameworkDriver.Load(String testAssemblyPath, IDictionary`2 settings)
[17:41:15]
[Step 3/3]    ў NUnit.Engine.Runners.DirectTestRunner.LoadDriver(IFrameworkDriver driver, String testFile, TestPackage subPackage)
[17:41:15]
[Step 3/3]

- it cant find nunit.framework, which is referenced by project not directly, but via NUnit nuget package.

NUnit extenstions are installed as said on page https://confluence.jetbrains.com/display/TCDL/NUnit#NUnit-NUnit3Extensions

0
1 comment

Hi
You should make sure that the assembly `nunit.framework` is located near the testing assembly before running tests.

When you are using command `dotnet build` dotnet does not copy dependencies from NuGet cache to an output directory.

To run tests by `nunit` runner you could use command `dotnet publish` to publish your test project with dependencies to some directory before tests.

Another way is to use the dotnet CLI plugin.

0

Please sign in to leave a comment.