.NET CF单元测试使用模拟器 - 测试运行错误

5

测试运行错误:

无法加载执行此测试所需的测试适配器('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的未解决问题,我应该尝试其他工具/可能性吗?

enter image description here

System.IO.FileNotFoundException 未处理

系统找不到文件

Source="Device Connection Manager" StackTrace: 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() InnerException:

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


1
在尝试运行测试之前,您是否已在模拟器上安装了CF 3.5? - ctacke
2个回答

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

并且适用于VS2010

 C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies

我收到了2个错误信息。要么是vstesthost.exe崩溃,详细信息中给出以下行:

vstesthost.exe
Microsoft.SmartDevice.Connectivity
System.IO.FileNotFoundException

或者单元测试框架会抛出此异常

"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()

1
如果您刚刚安装了移动设备的SDK,则可能已安装尚未初始化的框架。请尝试重新启动。

如果您安装了多个移动SDK(WM5,WM6.1,WM6.3.5等),请确保您的项目尝试启动您正在针对的版本。

如果所有其他方法都失败了,您可以尝试卸载模拟器,重新启动(因为我们喜欢Windows),然后再次安装,重新启动(因为它仍然是Windows),然后返回您的项目。


我现在使用NUnitLite。因为我们仍然非常喜欢Windows。 - hellboy

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接