← Back to team overview

nunit-core team mailing list archive

Re: [Bug 595683] [NEW] NUnit console runner fails to load assemblies

 

This is a valid bug - thanks for reporting it. Just one note for your
information, however...
test-runner.exe is _not_ the new nunit-console runner. It's merely a program
used to test
the framework itself. There will be a new nunit-console runner for NUnit
3.0... it's just
not out there yet.

Charlie

On Thu, Jun 17, 2010 at 2:00 PM, Christian Horsdal
<c.horsdal@xxxxxxxxx>wrote:

> Public bug reported:
>
> 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>
>
> ** Affects: nunit-3.0
>     Importance: Undecided
>         Status: New
>
> --
> NUnit console runner fails to load assemblies
> https://bugs.launchpad.net/bugs/595683
> You received this bug notification because you are subscribed to NUnit
> Framework.
>

-- 
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
Core Developers, which is the registrant for NUnit Framework.

Status in NUnit Test Framework: New

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