1

我们正在使用 Moles 框架 (0.94.5) 编写单元测试用例,但无法调试或运行测试用例。

系统:Win7 64位

痣:0.94.5 64bit with VS 2010 pro

解决方案构建成功。但是在尝试运行测试用例时,我们收到以下错误。

{
Error
9/6/2013 3:35:32 PM

System.InvalidOperationException  : Could not start Moles host. Please review the Test Run Errors for more information.   //error

   at Microsoft.Moles.VsHost.Agent.HostTestAdapterDriver.EnsureHostAdapter()
   at //error
Microsoft.Moles.VsHost.Agent.HostTestAdapterDriver.Microsoft.VisualStudio.TestTools.Execution.IBaseAdapter.Run(ITestElement testElement, ITestContext testContext)
   at Microsoft.Moles.VsHost.Agent.MolesAgentAdapter.Run(ITestElement testElement, ITestContext testContext)  //error 
U0319VM2184

我们还按照 fuslogvw 来识别在程序集加载过程中是否有任何错误。它给了 Moles 说的两个错误

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable  C:\Program Files\Microsoft Moles\bin\moles.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: User = NORD\x03g
LOG: DisplayName = Microsoft.Moles, Version=0.94.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
 (Fully-specified)
LOG: Appbase = file:///C:/Program Files/Microsoft Moles/bin/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = moles.exe
Calling assembly : moles, Version=0.94.0.0, Culture=neutral,   PublicKeyToken=31bf3856ad364e35.
}
===
LOG: Start binding of native image Microsoft.Moles, Version=0.94.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
WRN: No matching native image found.

我们检查了配置,一切似乎都很好。在其中一篇博客中提到要从 VS2010 IDE 文件夹下的 privateassemblies 文件夹中删除 .exe.config 文件。但无法让它工作。

在遵循上述错误之后,我们得到的错误是痣在与项目所在的不同驱动器中寻找项目 dll。

在我们卸载痣重新启动并安装痣后重新启动机器但无济于事。

找不到发布此内容的正确类别。

谢谢

维姬

4

1 回答 1

2

+1表示已经完成的研究。很感激,它会让你走得更远。

我可以添加以下内容:您有一台 64 位机器和 64 位摩尔。您正在运行的测试也是 64 位的吗?如果是,以下为我解决了这个问题。如果没有,还是试试吧。

  1. 编辑您的测试设置。在 VS2010 中,转到测试 -> 编辑测试设置。从左侧菜单中选择“主机”。
  2. 选择“在 64 位机器上以 64 位进程运行测试”选项。
  3. 节省
  4. AssemblyInfo.cs现在在您的测试项目中打开该文件。
  5. 在文件的底部,添加以下行[assembly: MolesAssemblySettings(Bitness = MolesBitness.x64)]
  6. 解决任何引用。

这就是我所需要的。

于 2013-11-08T21:34:33.950 回答