Can't run tests from a network share in 2.6

106 views
Skip to first unread message

Tom Cabanski

unread,
Mar 18, 2012, 11:37:22 AM3/18/12
to nunit-...@googlegroups.com
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()

Charlie Poole

unread,
Mar 18, 2012, 3:38:33 PM3/18/12
to nunit-...@googlegroups.com
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

--
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.

Tom Cabanski

unread,
Mar 19, 2012, 5:56:47 AM3/19/12
to nunit-...@googlegroups.com, Tim Coonfield, Al Dass

Charlie,

I don't see it is a critical feature.  This is only happening on an old CI environment for a legacy code base that is being phased out.  The update to Nunit 2.6 wasn't critical so I downgraded back to 2.5.9.  If the org does decide to upgrade, we can always assign a drive letter so we can work around it.

Thanks for the info.
Reply all
Reply to author
Forward
0 new messages