Help configuring MSpec

半腔热情 提交于 2019-12-23 03:44:12

问题


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


回答1:


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.




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/2782457/help-configuring-mspec

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!