views:

694

answers:

4

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?

+3  A: 

Install testdriven.net, there is a free personal version

http://www.testdriven.net/

simon_bellis
+3  A: 
  • 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.

Yann Trevin
+2  A: 

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.

runxc1 Bret Ferrier
The Test List Editor is the only way without installing yet another Dev Tool. However I now believe that it is a bug that all tests run in VS 2010 when you "Run Tests in Current Context"
runxc1 Bret Ferrier
A: 

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.

Sean B