Google Groups

Re: [nunit-discuss] Can't run tests from a network share in 2.6


charlie Mar 18, 2012 12:38 PM
Posted in group: NUnit-Discuss
Hi Tom,

NUnit has never supported running tests from a server share unless you assign that share a drive letter. While it may have worked in some cases, it's not a "feature" as such and we don't make any effort to preserve it.

The most basic reason for this is that NUnit sets the current directory temporarily to the directory containing the test assembly while it is being loaded. This helps .NET find any unmanaged dlls that are used by the tests or the system under test. Setting the current directory to a UNC path is - of course - not possible. Hence, the exception.

NUnit also sets the current directory while tests are running, to enable the tests to make use of relative paths. This is being removed in NUnit 3.0, since you can now use the assembly path from TestContext to form paths within your tests, but the problem of loading assemblies still remains.

If anyone has a real need to support tests reciding at UNC paths, we can discuss it and consider some other approach for 3.0, but for 2.6 you're basically stuck.

Charlie

On Sun, Mar 18, 2012 at 8:37 AM, Tom Cabanski <t...@cabanski.com> wrote:
Executing nunit-console \\server\path\my.dll from a directory c:\myLocalDir results in the following error when using Nunit 2.6.0.12054.  This was not a problem in 2.5.9.

Unhandled Exception: System.ApplicationException: Exception in TestRunnerThread ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'c:\myLocalDir\server\path\my.dll'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Directory.SetCurrentDirectory(String path)
   at NUnit.Core.TestFixture.Run(EventListener listener, ITestFilter filter)
   at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
   at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)
   at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)
   at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)
   at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
   at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)
   at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)
   at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)
   at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
   at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)
   at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)
   at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)
   at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
   at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)
   at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)
   at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)
   at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
   at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)
   at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)
   at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)
   at NUnit.Core.SimpleTestRunner.Run(EventListener listener, ITestFilter filter, Boolean tracing, LoggingThreshold logLevel)
   at NUnit.Core.TestRunnerThread.TestRunnerThreadProc()
   --- End of inner exception stack trace ---
   at NUnit.Core.TestRunnerThread.TestRunnerThreadProc()
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

--
You received this message because you are subscribed to the Google Groups "NUnit-Discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/nunit-discuss/-/rgnccOe-IecJ.
To post to this group, send email to nunit-...@googlegroups.com.
To unsubscribe from this group, send email to nunit-discus...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nunit-discuss?hl=en.