nunit-core team mailing list archive
-
nunit-core team
-
Mailing list archive
-
Message #00894
[Bug 595683] Re: NUnit console runner fails to load assemblies
** Changed in: nunitv2
Status: Triaged => Fix Committed
** Changed in: nunitv2
Milestone: None => 2.5.7
--
NUnit console runner fails to load assemblies
https://bugs.launchpad.net/bugs/595683
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
Status in NUnit Test Framework: Fix Committed
Status in NUnit V2 Test Framework: Fix Committed
Bug description:
I am using NUnit 2.9.4 which I have downloaded as source and compiled with VS2010 RC.
I had trouble loading my test assemblies running the test-runner.exe gives the following output:
----------------------------------------------------------------------------------------------------------------------
PS C:\projects\Specs\Specs.Test\bin\Debug> ..\..\..\..\NUnit\NUnit-2.9.4\solutions\vs2010\bin\Debug\test-runner.exe .\Specs.Test.dll
TestRunner version 1.0.0
Copyright c 2009 Charlie Poole
Runtime Environment -
OS Version: Microsoft Windows NT 5.1.2600 Service Pack 3
.NET Version: 4.0.30128.1
Options -
Use Same AppDomain
Could not load file or assembly 'Specs.Test' or one of its dependencies. The system cannot find the file specified.
PS C:\projects\Specs\Specs.Test\bin\Debug>
----------------------------------------------------------------------------------------------------------------------------
If I change the method Load on the class DefaultTestAssemblyBuilder in the file NUnit-2.9.4\src\framework\Internal\DefaultTestAssemblyBuilder.cs from
private Assembly Load(string path)
{
Assembly assembly = null;
// Throws if this isn't a managed assembly or if it was built
// with a later version of the same assembly.
AssemblyName assemblyName = AssemblyName.GetAssemblyName(Path.GetFileName(path));
// TODO: Figure out why we can't load using the assembly name
// in all cases. Might be a problem with the tests themselves.
assembly = Assembly.Load(Path.GetFileNameWithoutExtension(path));
if (assembly != null)
CoreExtensions.Host.InstallAdhocExtensions(assembly);
InternalTrace.Info("Loaded assembly " + assembly.FullName);
return assembly;
}
to
private Assembly Load(string path)
{
Assembly assembly = null;
// Throws if this isn't a managed assembly or if it was built
// with a later version of the same assembly.
AssemblyName assemblyName = AssemblyName.GetAssemblyName(Path.GetFileName(path));
// TODO: Figure out why we can't load using the assembly name
// in all cases. Might be a problem with the tests themselves.
assembly = Assembly.Load(assemblyName);
if (assembly != null)
CoreExtensions.Host.InstallAdhocExtensions(assembly);
InternalTrace.Info("Loaded assembly " + assembly.FullName);
return assembly;
}
I can load my assemblies. -The difference in the code is that the Assembly.Load call takes the AssemblyName instead of the path.
With the code change the test-runner output is:
PS C:\projects\Specs\Specs.Test\bin\Debug> ..\..\..\..\NUnit\NUnit-2.9.4\solutions\vs2010\bin\Debug\test-runner.exe .\Specs.Test.dll
TestRunner version 1.0.0
Copyright c 2009 Charlie Poole
Runtime Environment -
OS Version: Microsoft Windows NT 5.1.2600 Service Pack 3
.NET Version: 4.0.30128.1
Options -
Use Same AppDomain
Tests run: 6, Errors: 0, Failures: 0, Inconclusive: 0
Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0
Time: 0,031 seconds
PS C:\projects\Specs\Specs.Test\bin\Debug>
References