NUnit 3.6 tests failing to run but run from command prompt [SOLVED]

Completed

[SOLVED - bug in NUnit 3.6 , workaround is to add --agents=1 to nunit3-console command line. Fix to NUnit is being prepared.]

Unsetting "Run recently failed tests first" in the build step seemed to help for a couple of runs but then no ... see comment below

I am running our tests using NUnit 3.6.0 from msbuild and they are failing as below. I can run the same command line in a command prompt as the SYSTEM user like TeamCity is using with no issue. I would set the environment variables as recommended here https://confluence.jetbrains.com/display/TCD9/Common+Problems#CommonProblems-BuildfailsorbehavesdifferentlyinTeamCitybutnotlocally but I can't see any easy way to do that.

Any ideas what this might be. Seems to be a problem in the test runner itself. Command line options are --teamcity --x86 --workers=0 --process=Multiple --where cat=UnitTest (I added --workers=0 --process=Multiple to try to fix the issue).

Teamcity version is 9.1 (build 36973), Nuget Package versions are:

<package id="NUnit.Console" version="3.6.0" />
<package id="NUnit.ConsoleRunner" version="3.6.0" />
<package id="NUnit.Extension.NUnitProjectLoader" version="3.5.0" />
<package id="NUnit.Extension.NUnitV2Driver" version="3.6.0" />
<package id="NUnit.Extension.NUnitV2ResultWriter" version="3.5.0" />
<package id="NUnit.Extension.TeamCityEventListener" version="1.0.2" />
<package id="NUnit.Extension.VSProjectLoader" version="3.5.0" />
<package id="NUnit3TestAdapter" version="3.7.0" />

[01:19:20][Exec] EXEC D:\work\BLINDS-v16.4.2.0_NUnit3\Shared\Core\NonWeb.UnitTests\bin\Release\Accent.Core.NonWeb.UnitTests.dll
[01:19:20][Exec] Object reference not set to an instance of an object.
[01:19:20][Exec] at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
[01:19:20][Exec] at NUnit.Engine.Services.TestAgency.LaunchAgentProcess(TestPackage package)
[01:19:20][Exec] at NUnit.Engine.Services.TestAgency.CreateRemoteAgent(TestPackage package, Int32 waitTime)
[01:19:20][Exec] at NUnit.Engine.Runners.ProcessRunner.CreateAgentAndRunner()
[01:19:20][Exec] at NUnit.Engine.Runners.ProcessRunner.RunTests(ITestEventListener listener, TestFilter filter)
[01:19:20][Exec]
[01:19:20][Exec] EXEC D:\work\BLINDS-v16.4.2.0_NUnit3\Shared\Core\Service.Contracts.UnitTests\bin\Release\Accent.Core.Service.Contracts.UnitTests.dll
[01:19:20][Exec] Object reference not set to an instance of an object.
[01:19:20][Exec] at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
[01:19:20][Exec] at NUnit.Engine.Services.TestAgency.LaunchAgentProcess(TestPackage package)
[01:19:20][Exec] at NUnit.Engine.Services.TestAgency.CreateRemoteAgent(TestPackage package, Int32 waitTime)
[01:19:20][Exec] at NUnit.Engine.Runners.ProcessRunner.CreateAgentAndRunner()
[01:19:20][Exec] at NUnit.Engine.Runners.ProcessRunner.RunTests(ITestEventListener listener, TestFilter filter)
[01:19:20][Exec]
0
1 comment
Avatar
Permanently deleted user

So, not solved... slightly different errors this time. Worked a couple of times ok and then this...

[12:42:03][Exec] EXEC D:\work\BLINDS-v16.4.2.0_NUnit3\Shared\Core\Service.Contracts.UnitTests\bin\Release\Accent.Core.Service.Contracts.UnitTests.dll
[12:42:03][Exec] Index was outside the bounds of the array.
[12:42:03][Exec] at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
[12:42:03][Exec] at NUnit.Engine.Services.TestAgency.LaunchAgentProcess(TestPackage package)
[12:42:03][Exec] at NUnit.Engine.Services.TestAgency.CreateRemoteAgent(TestPackage package, Int32 waitTime)
[12:42:03][Exec] at NUnit.Engine.Runners.ProcessRunner.CreateAgentAndRunner()
[12:42:03][Exec] at NUnit.Engine.Runners.ProcessRunner.RunTests(ITestEventListener listener, TestFilter filter)
[12:42:03][Exec]
[12:42:03][Exec] EXEC D:\work\BLINDS-v16.4.2.0_NUnit3\Shared\Core\Service.UnitTests\bin\Release\Accent.Core.Service.UnitTests.dll
[12:42:03][Exec] Source array was not long enough. Check srcIndex and length, and the array's lower bounds.
[12:42:03][Exec] at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
[12:42:03][Exec] at System.Collections.Generic.Dictionary`2.Resize(Int32 newSize, Boolean forceNewHashCodes)
[12:42:03][Exec] at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
[12:42:03][Exec] at NUnit.Engine.Services.TestAgency.LaunchAgentProcess(TestPackage package)
[12:42:03][Exec] at NUnit.Engine.Services.TestAgency.CreateRemoteAgent(TestPackage package, Int32 waitTime)
[12:42:03][Exec] at NUnit.Engine.Runners.ProcessRunner.CreateAgentAndRunner()
[12:42:03][Exec] at NUnit.Engine.Runners.ProcessRunner.RunTests(ITestEventListener listener, TestFilter filter)
0

Please sign in to leave a comment.