Exception after building Coded UI test

Bug #1165359 reported by David Gardiner
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
NUnit Test Adapter
Fix Released
High
Terje Sandstrom

Bug Description

The following stack trace is logged:

------ Discover test started ------
Exception thrown discovering tests in D:\Dev\Sandbox\CodedUITestProject2\CodedUITestProject2\bin\Debug\CodedUITestProject2.dll
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.TestTools.UITesting, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.VisualStudio.TestTools.UITesting, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

Server stack trace:
   at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
   at System.Reflection.RuntimeAssembly.GetExportedTypes()
   at NUnit.Core.CoreExtensions.InstallAdhocExtensions(Assembly assembly)
   at NUnit.Core.Builders.TestAssemblyBuilder.Load(String path)
   at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites)
   at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites)
   at NUnit.Core.TestSuiteBuilder.BuildSingleAssembly(TestPackage package)
   at NUnit.Core.TestSuiteBuilder.Build(TestPackage package)
   at NUnit.Core.SimpleTestRunner.Load(TestPackage package)
   at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
   at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
   at NUnit.Core.RemoteTestRunner.Load(TestPackage package)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at NUnit.Core.TestRunner.Load(TestPackage package)
   at NUnit.Util.TestDomain.Load(TestPackage package)
   at NUnit.VisualStudio.TestAdapter.NUnitTestDiscoverer.DiscoverTests(IEnumerable`1 sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

An exception occurred while test discoverer 'NUnitTestDiscoverer' was loading tests. Exception: Object reference not set to an instance of an object.
========== Discover test finished: 1 found (0:00:00.2506002) ==========
------ Run test started ------
========== Run test finished: 1 run (0:00:12.520006) ==========

That assembly is not added as a reference by default. Adding it manually didn't solve the problem.

Using VS 2012.2 + Adapter beta 4.

-dave

Related branches

Revision history for this message
Charlie Poole (charlie.poole) wrote : Re: [Bug 1165359] [NEW] Exception after building Coded UI test
Download full text (4.1 KiB)

Coded UI tests are a specific feature of Visual Studio and MSTest. I found
a discussion thread from 2011, where a Microsoft MSTest engineer said "We
don't have any plans to decouple Coded UI Test from the current Unit Test
Framework."

I'll check with the Microsoft folks who provide the new Test Platform in
Visual Studio to see whether there are any plans to allow running of Coded
UI tests written in NUnit. If they have such plans, we'll keep this bug to
stand for whatever work is necessary in the adapter. If they don't, I'll
just close it.

On Sat, Apr 6, 2013 at 3:27 AM, David Gardiner <email address hidden>wrote:

> Public bug reported:
>
> The following stack trace is logged:
>
> ------ Discover test started ------
> Exception thrown discovering tests in
> D:\Dev\Sandbox\CodedUITestProject2\CodedUITestProject2\bin\Debug\CodedUITestProject2.dll
> System.IO.FileNotFoundException: Could not load file or assembly
> 'Microsoft.VisualStudio.TestTools.UITesting, Version=11.0.0.0,
> Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its
> dependencies. The system cannot find the file specified.
> File name: 'Microsoft.VisualStudio.TestTools.UITesting, Version=11.0.0.0,
> Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
>
> Server stack trace:
> at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly
> assembly, ObjectHandleOnStack retTypes)
> at System.Reflection.RuntimeAssembly.GetExportedTypes()
> at NUnit.Core.CoreExtensions.InstallAdhocExtensions(Assembly assembly)
> at NUnit.Core.Builders.TestAssemblyBuilder.Load(String path)
> at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName,
> Boolean autoSuites)
> at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName,
> String testName, Boolean autoSuites)
> at NUnit.Core.TestSuiteBuilder.BuildSingleAssembly(TestPackage package)
> at NUnit.Core.TestSuiteBuilder.Build(TestPackage package)
> at NUnit.Core.SimpleTestRunner.Load(TestPackage package)
> at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
> at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
> at NUnit.Core.RemoteTestRunner.Load(TestPackage package)
> at
> System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr
> md, Object[] args, Object server, Object[]& outArgs)
> at
> System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage
> msg)
>
> Exception rethrown at [0]:
> at
> System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
> reqMsg, IMessage retMsg)
> at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
> msgData, Int32 type)
> at NUnit.Core.TestRunner.Load(TestPackage package)
> at NUnit.Util.TestDomain.Load(TestPackage package)
> at
> NUnit.VisualStudio.TestAdapter.NUnitTestDiscoverer.DiscoverTests(IEnumerable`1
> sources, IDiscoveryContext discoveryContext, IMessageLogger logger,
> ITestCaseDiscoverySink discoverySink)
>
> WRN: Assembly binding logging is turned OFF.
> To enable assembly bind failure logging, set the registry value
> [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
> Note: There is some performance penalty asso...

Read more...

Revision history for this message
David Gardiner (cavid) wrote :

The problem is that this error gets displayed even if I'm not trying to use NUnit - the Coded UI test project was just the 'out of the box' MS Test one created by Visual Studio, and yet it looks like the NUnit Adapter was trying (and failing) to look at it.

This was also causing ReSharper to get confused about resolving some of the types (lots of red getting displayed in the text editor) - though the project would compile without error.

Disabling the NUnit Adapter made ReSharper happier.

Revision history for this message
Charlie Poole (charlie.poole) wrote : Re: [Bug 1165359] Re: Exception after building Coded UI test

When you run tests in an assembly, the Test Explorer asks each adapter to
try to discover tests in it. The NUnit adapter asks NUnit to load the tests
and that's where the error occurs. We need to figure out in which cases the
error should simply be ignored.

On Sat, Apr 6, 2013 at 9:41 PM, David Gardiner <email address hidden>wrote:

> The problem is that this error gets displayed even if I'm not trying to
> use NUnit - the Coded UI test project was just the 'out of the box' MS
> Test one created by Visual Studio, and yet it looks like the NUnit
> Adapter was trying (and failing) to look at it.
>
> This was also causing ReSharper to get confused about resolving some of
> the types (lots of red getting displayed in the text editor) - though
> the project would compile without error.
>
> Disabling the NUnit Adapter made ReSharper happier.
>
> --
> You received this bug notification because you are subscribed to NUnit
> Extended Testing Platform.
> https://bugs.launchpad.net/bugs/1165359
>
> Title:
> Exception after building Coded UI test
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunit-vs-adapter/+bug/1165359/+subscriptions
>

Changed in nunit-vs-adapter:
importance: Undecided → Medium
Changed in nunit-vs-adapter:
status: New → Triaged
importance: Medium → High
milestone: none → 0.95
assignee: nobody → Terje Sandstrom (b-tfrje-j)
Revision history for this message
Terje Sandstrom (b-tfrje-j) wrote :

This exception does not prevent the further tests to be run. However, I have changed the reporting of it to be reported explicitly, and that it can be ignored if the project it refers to is not a NUnit test project.

Changed in nunit-vs-adapter:
status: Triaged → In Progress
Revision history for this message
Terje Sandstrom (b-tfrje-j) wrote :

David has verified [offline] that the current code does not have the same issue.

Changed in nunit-vs-adapter:
status: In Progress → Fix Committed
Changed in nunit-vs-adapter:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.