.NET CF UnitTesting with emulator - 测试运行错误

hel*_*boy 5 unit-testing compact-framework

测试运行错误:

执行此测试所需的测试适配器('Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter,Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter,Version = 9.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a')没有加载.检查测试适配器是否安装正确.错误:智能设备主机适配器无法初始化.

实际情况:已知问题"辅助线程中的单元测试中的异常会导致vstesthost"

已添加到C:\ Program Files\Microsoft Visual Studio 9.0\Common7\IDE\VSTestHost.exe.config解决

以下行:

Microsoft.VisualStudio.SmartDevice.UnitTestFramework.dll已添加到GAC:

"C:\ Program Files\Microsoft SDKs\Windows\v6.0A\bin\gacutil.exe"-i"C:\ Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.SmartDevice.UnitTestFramework. DLL"

但我仍然收到错误消息,无法在模拟器上运行单元测试.

或者可能这仍是Visual Studio 2008尚未解决的问题,我应该尝试其他工具/可能性?

在此输入图像描述

System.IO.FileNotFoundException未处理

系统无法找到文件

Source ="Device Connection Manager"StackTrace:位于Microsoft.VisualStudio.SmartDevice.TestHostAdapter.DeviceAgent的Microsoft.SmartDevice.Connectivity.FileDeployer.DownloadPackage(ObjectId packageId)中的Microsoft.VisualStudio.DeviceConnectivity.Interop.ConManServerClass.DownloadPackage(String pwszPackageId). RunConfigDevice.InitializeStreamingWithDevice()在Microsoft.VisualStudio.SmartDevice.TestHostAdapter.DeviceAgent.DeviceHostAdapter.initializeInternal()在System.Threading.ThreadHelper.ThreadStart_Context(对象状态)在System.Threading.ExecutionContext.Run(的ExecutionContext的ExecutionContext,ContextCallback回调,对象状态)在System.Threading.ThreadHelper.ThreadStart()InnerException:

http://img688.imageshack.us/img688/2025/20120808testrunerrorexc.gif

rob*_*r78 1

我在这里找到了答案:http://social.msdn.microsoft.com/Forums/en/vssmartdevicesvbcs/thread/72fbc539-cf28-4643-b7bf-2ced70018d2e

也许不是最优雅的解决方案,但我只是将 SmartDevice.UnitTestFramework.dll 及其 xml 配置文件从 VS 2008 公共程序集文件夹复制到 VS 2010 公共程序集文件夹,它对我有用。

在我的机器上,这些文件夹是 VS2008 的

C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies
Run Code Online (Sandbox Code Playgroud)

对于 VS2010

 C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies
Run Code Online (Sandbox Code Playgroud)

我收到 2 条错误消息。vstesthost.exe 崩溃并详细给出了这一行

vstesthost.exe
Microsoft.SmartDevice.Connectivity
System.IO.FileNotFoundException
Run Code Online (Sandbox Code Playgroud)

或者单元测试框架抛出这个异常

"The system cannot find the file specified.\r\n"
"Device Connection Manager"
at Microsoft.VisualStudio.DeviceConnectivity.Interop.ConManServerClass.DownloadPackage(String pwszPackageId)
at Microsoft.SmartDevice.Connectivity.FileDeployer.DownloadPackage(ObjectId packageId)
at Microsoft.VisualStudio.SmartDevice.TestHostAdapter.DeviceAgent.RunConfigDevice.InitializeStreamingWithDevice()
at Microsoft.VisualStudio.SmartDevice.TestHostAdapter.DeviceAgent.DeviceHostAdapter.initializeInternal()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Run Code Online (Sandbox Code Playgroud)