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.FileNotFoundE开发者_运维百科xception: 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()
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.
After changing any dll you should clean up project - so you don't have any errors in fresh project.
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.
精彩评论