VS 2010 and MBUnit how to run just one test

2019-06-24 04:44发布

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?

4条回答
看我几分像从前
2楼-- · 2019-06-24 05:37
  • 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.

查看更多
smile是对你的礼貌
3楼-- · 2019-06-24 05:37

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.

查看更多
Melony?
4楼-- · 2019-06-24 05:37

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.

查看更多
虎瘦雄心在
5楼-- · 2019-06-24 05:39

Install testdriven.net, there is a free personal version

http://www.testdriven.net/

查看更多
登录 后发表回答