我们使用Moles框架(0.94.5)来编写单元测试用例,但不能调试或运行测试用例。
系统: Win7 64位
Moles: 0.94.5 64位,带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集成开发环境文件夹下的privateassemblies文件夹中删除.exe.config文件。但不能让它工作。
在执行上述操作之后,我们得到的错误是moles在与project所在的驱动器不同的驱动器中查找project dll。
卸载moles后,重新启动并安装moles,重新启动机器,但无济于事。
找不到合适的类别来张贴这篇文章。
谢谢
维基
发布于 2013-11-09 05:34:34
对于已经完成的研究,+1。我很欣赏它,它会带你走得更远。
我可以补充如下:你有一台64位的机器和64位的moles。你正在运行的测试也是64位的吗?如果是这样的话,下面的代码为我解决了这个问题。如果没有,无论如何都要尝试一下。
AssemblyInfo.cs文件。[assembly: MolesAssemblySettings(Bitness = MolesBitness.x64)]references。
这就是我所需要的。
https://stackoverflow.com/questions/18738251
复制相似问题