VS 2010 and MBUnit how to run just one test

大憨熊 提交于 2019-12-10 16:21:42

问题


I have Gallio/MbUnit installed and am using VS 2010 RC and I want to be able to run a single unit test or just all unit tests inside of a TestFixture and not all the tests in the entire project everytime I debug. How do you do this in VS 2010?


回答1:


Install testdriven.net, there is a free personal version

http://www.testdriven.net/




回答2:


  • As Simon said, TD.Net is just working well.
  • If you work with VS2010 Premium or Ultimate, you may also use the built-in test run feature of VS2010. It should find and run your MbUnit tests as well (if the Gallio add-in was installed)
  • You may also run your tests by using Resharper 5, but it seems that the latest beta of Resharper 5 has broken the Gallio test driver. It should be fixed soon however.

Apart from the VS2010 IDE, you may also run your tests with Echo (a powerful console application located in the bin folder of the Gallio installation directory), Icarus (Winform application with a nice UI; same location), or from PowerShell (by using the Run-Gallio snap-in). You can also invoke the test runner from one of the numerous extensions of Gallio for MSBuild, NAnt, TeamCity, etc.




回答3:


I didn't see it earlier but VS 2010 has a Test List Editor which allows me to add the specific test to a a list and run it from there so that only the one test is run. I know that TD.Net probably has a right click/run test option for a test method but I didn't want to buy it and install yet another tool.




回答4:


Another alternative, how we do it is select the specification inside visual studio, press F5, and it runs the specification via a Rake task.

Example:

class DiffuserObserverSpecification 
      : AutoMockSpecification<DiffuserObserver, IDiffuserObserver>

class When_diffuser_observer_is_created : DiffuserObserverSpecification

class When_diffuser_observer_has_injected_diffuser_change 
      : DiffuserObserverSpecification

So to execute the behaviour expectations of all DiffuserObserverSpecification, we select the DiffuserObserverSpecification and press F5.

And to execute just the behaviour for When_diffuser_observer_is_created, select that and press F5.

After one month you forget what I debugger looks like.



来源:https://stackoverflow.com/questions/2254167/vs-2010-and-mbunit-how-to-run-just-one-test

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