← Back to team overview

nunit-core team mailing list archive

[Bug 860558] Re: pnunit-agent can't run a tests from another folder

 

I'm sorry. Instead of "nunit-agent.exe" should read "pnunit-agent.exe".

Consider a simple project. It depends only on the "nunit.framework.dll".
The result of compilation is placed in the subdirectory "bin".
To run the "pnunit-agent.exe" type the command "pnunit-agent.exe 8000 ." in the "bin" directory.
When you start the tests will be displayed error:

ERROR PNUnit.Agent.PNUnitTestRunner - Error running test Couldn't find
assembly 'pnunit.framework, Version=1.0.4357.24760, Culture=neutral,
PublicKeyToken=null'

To correct this error in the directory "bin" should be present copies of
the files "pnunit-agent.exe" and "pnunit.framework.dll".

I reviewed various possibilities fix this problem. The easiest way to -
modify the behavior of "NUnit.Core.AssemblyResolver".

Initially, the bug is reproducible under DotNet 4.0
The solution proposed for the "NUnit-2.6.0.11340" under Mono.

Example - is attached.
"agent" and "agent2" - examples run of "pnunit-agent.exe"
"launch" - examples run of tests
NUnit files will be searched for the path "/home/$USER/bin/NUnit-2.6.0.11340/bin"

-- 
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
https://bugs.launchpad.net/bugs/860558

Title:
  pnunit-agent can't run a tests from another folder

Status in NUnit V2 Test Framework:
  New

Bug description:
  if the assembly `pnunit.tests.dll` located in another directory then
  the process `pnunit-agent.exe` can not download the file `pnunit-
  agent.exe` as a dll library.

  I recommend the following modification of the file:

  === modify file src/NUnitCore/core/AssemblyResolver.cs
  --- src/NUnitCore/core/AssemblyResolver.cs	2009-02-01 05:16:27 +0000
  +++ src/NUnitCore/core/AssemblyResolver.cs	2011-09-09 09:28:02 +0000
  @@ -9,7 +9,8 @@
    using System;
    using System.IO;
    using System.Reflection;
  -	using System.Collections;
  +	using System.Collections;
  +	using System.Collections.Generic;

    /// <summary>
    /// Class adapted from NUnitAddin for use in handling assemblies that are not
  @@ -92,8 +93,11 @@
      }

      foreach( string dir in _dirs )
  -			{
  -				foreach( string file in Directory.GetFiles( dir, "*.dll" ) )
  +			{
  +				List<string> dllCandidates = new List<string>();
  +				dllCandidates.AddRange(Directory.GetFiles(dir, "*.dll"));
  +				dllCandidates.AddRange(Directory.GetFiles(dir, "*.exe"));
  +				foreach (string file in dllCandidates)
       {
        string fullFile = Path.Combine( dir, file );
                       AssemblyReader rdr = new AssemblyReader(fullFile);

To manage notifications about this bug go to:
https://bugs.launchpad.net/nunitv2/+bug/860558/+subscriptions


References