The NUnit-console 2.6.3 sometimes prints out the following error message instead of running tests. Here is excerpt from my Jenkins test build logs:
00:05:02.982 Process 'nunit-console-x86' [PID 3684] has begun profiling.
00:05:03.698 NUnit-Console version 2.6.3.13283
00:05:03.698 Copyright (C) 2002-2012 Charlie Poole.
00:05:03.698 Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
00:05:03.698 Copyright (C) 2000-2002 Philip Craig.
00:05:03.698 All Rights Reserved.
00:05:03.698
00:05:03.698 Runtime Environment -
00:05:03.701 OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
00:05:03.701 CLR Version: 2.0.50727.5485 ( Net 3.5 )
00:05:03.701
00:05:03.795 ProcessModel: Default DomainUsage: Single
00:05:03.795 Execution Runtime: net-3.5
00:05:33.886 Unable to locate fixture
00:05:33.895 Process 'nunit-console-x86' [PID 3684] has finished profiling.
It happens randomly. I do not change the test assembly or the NUnit configuration. I run NUnit via NCover, but the same problem repeats when I use NUnit alone from the command line.
After enabling the verbose logging in NUnit I noticed that the nunit-agent process prints out its first messages to the log more than half a minute after it was run by the nunit-console. I found out from the source code that nunit-console waits 30 seconds for the spawned nunit-agent process to register itself. Apparently something delays loading nunit-agent so the timeout is hit in nunit-console causing the "Unable to locate fixture ". The nunit-agent process is still running after that and I have to kill it manually.
NUnit-console log:
InternalTrace: Initializing at level Verbose
09:14:08.992 Info [ 1] Runner: NUnit-console.exe starting
09:14:09.006 Debug [ 1] ServiceManager: Added SettingsService
09:14:09.006 Debug [ 1] ServiceManager: Added DomainManager
09:14:09.007 Debug [ 1] ServiceManager: Added ProjectService
09:14:09.007 Debug [ 1] ServiceManager: Added AddinRegistry
09:14:09.007 Debug [ 1] ServiceManager: Added AddinManager
09:14:09.007 Debug [ 1] ServiceManager: Added TestAgency
09:14:09.008 Info [ 1] ServiceManager: Initializing SettingsService
09:14:09.008 Info [ 1] ServiceManager: Initializing DomainManager
09:14:09.008 Info [ 1] ServiceManager: Initializing ProjectService
09:14:09.008 Info [ 1] ServiceManager: Initializing AddinRegistry
09:14:09.008 Info [ 1] ServiceManager: Initializing AddinManager
09:14:09.009 Debug [ 1] ServiceManager: Request for service IAddinRegistry satisfied by AddinRegistry
09:14:09.017 Info [ 1] ServiceManager: Initializing TestAgency
09:14:09.041 Debug [ 1] ServiceManager: Request for service ProjectService satisfied by ProjectService
09:14:09.054 Debug [ 1] RuntimeFrameworkSelector: Current framework is net-3.5
09:14:09.054 Debug [ 1] RuntimeFrameworkSelector: No specific framework requested
09:14:09.054 Debug [ 1] ServiceManager: Request for service ISettings satisfied by SettingsService
09:14:09.058 Debug [ 1] RuntimeFrameworkSelector: Assembly D:\Jenkins\jobs\Job1\GreyBoxTests\bin\Debug\GreyBoxTests.dll uses version 4.0.30319
09:14:09.064 Debug [ 1] ServiceManager: Request for service TestAgency satisfied by TestAgency
09:14:09.065 Debug [ 1] RuntimeFrameworkSelector: Test will use net-4.0 framework
09:14:09.066 Info [ 1] ProcessRunner: Loading GreyBoxTests.dll
09:14:09.067 Info [ 1] TestAgency: Getting agent for use under net-4.0
09:14:09.070 Debug [ 1] TestAgency: Using nunit-agent at c:\Program Files (x86)\NUnit 2.6.3\bin\nunit-agent-x86.exe
09:14:09.091 Info [ 1] TestAgency: Launched Agent process 7240 - see nunit-agent_7240.log
09:14:09.091 Info [ 1] TestAgency: Command line: "c:\Program Files (x86)\NUnit 2.6.3\bin\nunit-agent-x86.exe" 65bc321d-e7dc-4a98-81e6-919b87d5c783 tcp://127.0.0.1:56614/TestAgency
09:14:09.091 Debug [ 1] TestAgency: Waiting for agent {65bc321d-e7dc-4a98-81e6-919b87d5c783} to register
09:14:39.091 Info [ 1] Runner: NUnit-console.exe terminating
NUnit-agent log:
InternalTrace: Initializing at level Verbose
09:14:41.859 Info [ 1] NUnitTestAgent: Agent process 7240 starting
09:14:41.876 Info [ 1] NUnitTestAgent: Running under version 4.0.30319.18444, Net 4.5
09:14:41.876 Info [ 1] NUnitTestAgent: Adding Services
09:14:41.876 Debug [ 1] ServiceManager: Added SettingsService
09:14:41.877 Debug [ 1] ServiceManager: Added ProjectService
09:14:41.877 Debug [ 1] ServiceManager: Added DomainManager
09:14:41.877 Debug [ 1] ServiceManager: Added AddinRegistry
09:14:41.877 Debug [ 1] ServiceManager: Added AddinManager
09:14:41.877 Info [ 1] NUnitTestAgent: Initializing Services
09:14:41.878 Info [ 1] ServiceManager: Initializing SettingsService
09:14:41.878 Info [ 1] ServiceManager: Initializing ProjectService
09:14:41.878 Info [ 1] ServiceManager: Initializing DomainManager
09:14:41.878 Info [ 1] ServiceManager: Initializing AddinRegistry
09:14:41.878 Info [ 1] ServiceManager: Initializing AddinManager
09:14:41.879 Debug [ 1] ServiceManager: Request for service IAddinRegistry satisfied by AddinRegistry
09:14:41.906 Info [ 1] NUnitTestAgent: Connecting to TestAgency at tcp://127.0.0.1:56614/TestAgency
09:14:41.907 Info [ 1] NUnitTestAgent: Starting RemoteTestAgent
09:14:41.908 Info [ 1] RemoteTestAgent: Agent starting
Any NUnit experts could help me with this?
Potential workaround, suggested by Charlie in that Google Groups thread:
I have confirmed that adding
<supportedRuntime version="v4.0.30319" />
inside<startup>
in the nunit-console.exe.config file (or nunit-console-x86.exe.config), and removing<supportedRuntime version="v2.0.50727"
(if present) does cause my tests to run without spawning an nunit-agent.exe process. I have not confirmed whether that fixes the error "unable to locate fixture" in my case, but the OP (krzysiek_w) did confirm it in the same thread:As an additional note, the option
/trace=Verbose
can be passed to NUnit to get more info, as krzysiek_w did in that thread. For me, those logs are output toC:\Users\(myuser)\AppData\Local\NUnit\logs
.