帮助配置 MSpec

发布于 2024-09-01 07:07:08 字数 1862 浏览 6 评论 0原文

装备:win7 64bit、vs2010、mvc v2、TestDriven.Net 3.0、Reshaper 5.0、MSpec 0.3

我最近开始了一个新项目,想要使用 mspec。

(1) 将 Machine.Specifications.ReSharperRunner.5.0.dll 和 Machine.Specifications.dll 复制到 JetBrains\ReSharper\5.0\Bin\Plugins\Machine.Specifications (2) 将 Machine.Specifications.TDNetRunner.dll 复制到 TestDriven.NET 3\ Machine.Specifications

当我尝试运行测试时,出现此错误: System.IO.FileNotFoundException:无法加载文件或程序集“Machine.Specifications”

我不知道此错误来自何处。

vs2010菜单-> ReSharper ->Plugins 显示 MSpec 插件。 vs2010菜单->ReSharper->选项->工具->单元测试还显示了 MSpec 单元测试提供程序,但当我单击它时,它不会像 MSTest 和 nUnit 那样显示任何详细信息。

我发现了这个: http://marcinobel.com/index.php/mspec-bdd -installer/ 不起作用。我也尝试过这个: http:// /eduncan911.com/blog/registering-mspec-runners-for-testdriven-net-on-windows-x64.aspx 也不起作用。现在我担心我搞砸了我的注册表。

有什么指导吗?

完整错误:

测试“F:Tests.OTBRadio.Tasks.AlbumTasksSpecs.when_the_album_tasks_are_asked_to_get_all.context”失败:无法加载文件或程序集“Machine.Specifications,Version=0.3.0.0,Culture=neutral,PublicKeyToken=null”或其之一依赖关系。系统找不到指定的文件。 System.IO.FileNotFoundException:无法加载文件或程序集“Machine.Specifications,Version=0.3.0.0,Culture=neutral,PublicKeyToken=null”或其依赖项之一。系统找不到指定的文件。 文件名:'Machine.Specifications,Version=0.3.0.0,Culture=neutral,PublicKeyToken=null' 在 Machine.Specifications.TDNetRunner.SpecificationRunner.RunMember(ITestListener testListener,Assembly 程序集,MemberInfo 成员) 在 TestDriven.TestRunner.AdaptorTestRunner.Run(ITestListener testListener,ITraceListener traceListener,字符串 assemblyPath,字符串 testPath) 在 TestDriven.TestRunner.ThreadTestRunner.Runner.Run()

rig: win7 64bit, vs2010, mvc v2, TestDriven.Net 3.0, Reshaper 5.0, MSpec 0.3

i recently started a new project and want to use mspec.

(1) copied Machine.Specifications.ReSharperRunner.5.0.dll and Machine.Specifications.dll to JetBrains\ReSharper\5.0\Bin\Plugins\Machine.Specifications (2) copied Machine.Specifications.TDNetRunner.dll to TestDriven.NET 3\Machine.Specifications

when i try to run the test i get this error: System.IO.FileNotFoundException: Could not load file or assembly 'Machine.Specifications

i don't know where this error is coming from.

vs2010 menu -> ReSharper ->Plugins shows the MSpec plugin. vs2010 menu ->ReSharper -> Options -> Tools -> Unit Testing also shows the MSpec unit testing provider but it doesn't show any details when i click on it as does MSTest and nUnit.

i found this: http://marcinobel.com/index.php/mspec-bdd-installer/ which didn't work. i also tried this: http://eduncan911.com/blog/registering-mspec-runners-for-testdriven-net-on-windows-x64.aspx which also didn't work. now i fear i screwed my registry.

any guidance?

full error:

Test 'F:Tests.OTBRadio.Tasks.AlbumTasksSpecs.when_the_album_tasks_are_asked_to_get_all.context' failed: Could not load file or assembly 'Machine.Specifications, Version=0.3.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'Machine.Specifications, Version=0.3.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'Machine.Specifications, Version=0.3.0.0, Culture=neutral, PublicKeyToken=null'
at Machine.Specifications.TDNetRunner.SpecificationRunner.RunMember(ITestListener testListener, Assembly assembly, MemberInfo member)
at TestDriven.TestRunner.AdaptorTestRunner.Run(ITestListener testListener, ITraceListener traceListener, String assemblyPath, String testPath)
at TestDriven.TestRunner.ThreadTestRunner.Runner.Run()

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

金兰素衣 2024-09-08 07:07:08

您不需要将 Machine.Specifications.TDNetRunner.dll 复制到任何地方,只需将其放在项目的 toolslib 目录中,即您所在的位置保留项目的依赖关系。包含 MSpec 测试的项目将引用此目录中的 Machine.Specifications.dll。只要 Machine.Specifications.dll.tdnet 位于同一目录中,TestDriven.Net >=2.24 就能够获取 TD.Net 运行程序。我喜欢如何组织 tools 目录的示例可以在 这里

你的 ReSharper 5.0 插件目录对我来说看起来不错。然而,我有用户报告说,当您解压缩 MSpec zip 文件时(您可能是从 http://teamcity.com 下载的)。 codebetter.com)使用资源管理器,Windows 将提取的 DLL 标记为从 Internet 下载。

您能否通过打开每个 DLL 的属性并单击第一个属性页上的“取消阻止”来确保 Windows 不会阻止 \bin\plugins 中的 DLL。如果未显示“取消阻止”按钮,则您的文件没有问题。在这种情况下,请在此处发帖,我们将了解您的 MSpec 插件如何工作。

You do not need to copy Machine.Specifications.TDNetRunner.dll anywhere, just place it in your project's tools or lib directory, i.e. where you keep your project's dependencies. The project containing the MSpec tests will reference the Machine.Specifications.dll from this directory. TestDriven.Net >=2.24 will be able to pick up the TD.Net runner as long as Machine.Specifications.dll.tdnet is located in the same directory. An example how I like to organize my tools directory can be found here.

Your ReSharper 5.0 plugin directory looks good to me. However, I've had users reporting that when you unzip the MSpec zip file (that you likely downloaded from http://teamcity.codebetter.com) using Explorer, Windows marks the extracted DLLs as being downloaded from the Internet.

Can you please make sure that Windows does not block the DLLs in <ReSharper 5.0>\bin\plugins by opening each DLL's properties and clicking "Unblock" on the first property page. In case the "Unblock" button is not displayed, your files are okay. In that case, please post here and we'll see how we can your MSpec plugin working.

老子叫无熙 2024-09-08 07:07:08

更改任何 dll 后,您应该清理项目 - 这样新项目中就不会出现任何错误。

After changing any dll you should clean up project - so you don't have any errors in fresh project.

灼痛 2024-09-08 07:07:08

我也遇到了同样的问题,我通过从 Github (https://github.com/machine/machine.specifications) 克隆 MSpec 的副本来修复它。

然后在“Source”文件夹中,我运行了一个批处理文件(在我的例子中为 build-4.0-debug.cmd),它在“xxx\Source\Build\Debug”中创建了“Machine.Specifications.dll”。

我删除了对“旧”dll 的引用,清理了我的项目,用我在上一步中获得的新 dll 复制了旧 dll,重新构建,这样就成功了。

I also had the same problem and I fixed it by cloning a copy of MSpec off Github (https://github.com/machine/machine.specifications).

Then in the "Source" folder I ran one of the batch files (in my case build-4.0-debug.cmd) which created "Machine.Specifications.dll" in "xxx\Source\Build\Debug".

I removed the references to the "old" dll, cleaned up my project, copied over the old dll with the new dll I obtained in the previous step, rebuilt and that did the trick.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文