I'm to use nunit-console
to run all of the tests in my solution.
I did this:
c:\some\path>nunit-console-x86.exe MySolution.sln
NUnit-Console version 2.6.2.12296
Copyright (C) 2002-2012 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.
Runtime Environment -
OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
CLR Version: 2.0.50727.5466 ( Net 3.5 )
ProcessModel: Default DomainUsage: Default
Execution Runtime: net-3.5
Could not load file or assembly 'MyNamespace.Administration, Version=0.0.0.1, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
So, I decided to try nunit-x86.exe
I did File > Open Project > MySolution.sln
and got this:
---------------------------
NUnit
---------------------------
Test load failed!
System.IO.FileNotFoundException : Could not load file or assembly
'MyNamespace.Administration, Version=0.0.0.1, Culture=neutral,
PublicKeyToken=null' or one of its dependencies. The system cannot
find the file specified.
For further information, use the Exception Details menu item.
---------------------------
OK
---------------------------
The exception can be found here
What is happening and how do I fix it? (without having to maintain a MySolution.nunit file)
More information
MyNamespace.Administration
is not even one of the dlls that contains tests, which means that nunit fails trying to load it to look for tests to run. Knowing this I edited the file created bynunit-x86.exe
(MySolution.nunit) and removed all dlls that did not have tests. Sure enough, the tests work (in both gui and console). This is not acceptable for me because it would mean that I have to keep yet another configuration file. Nunit supporting .sln files was supposed to avoid this.- My tests run fine using TestDriven.Net (but I really need to run them using nunit-console)
I have looked at this answer but I cannot make sense of what the fusion log viewer says. Would posting that log help?Assembly binding Log Viewer, lists 3 files being created:- nunit-agent-x86.exe, this one seems to be trying to find
MyNamespace.Administration.dll/EXE
inside the nunit directories - Tests_24398275 x2 - one looking for nunit.core in my project folders and another looking for unit.core.interfaces inside my project folders. I would pay little attention to these two since they also appear in my manually edited .nunit project).
- nunit-agent-x86.exe, this one seems to be trying to find
- (per andreister comment) The problem seems to be with the project/assembly itself and not the creation method. If I create a .nunit project and try to add
MyNamespace.Administration
to it (using 'Add Assembly...' or 'Add VS project...') it fails. - Calling
nunit-console-x86 somepath/bin/Debug/MyNamespace.Administration.dll
directly works.
MyNamespace.Administration.dll
contains the code used by the tests. Are you sure you didn't forget eg, to putCopyLocal=True
when referencing the project? – andreister.nunit
explicitly, to see if it would fail? Normally for a non-tests project NUnit just reports it doesn't have tests. – andreisterAdministration.dll
, then start adding them one by one and see if that makes a difference. – andreister