RSS
 

Posts Tagged ‘alt.net’

Bridging Unit Test Frameworks with Gallio

23 Aug
Update: Jetbrains have just released Resharper 4.5, which contains native MSTest support. No need to read the rest of this article, then! Sweet. Now I can use the Resharper test runner (superb) on MsUnit tests (mandated). Here in .Net land, we've got an awful lot of choice if we want to write unit tests. First we had NUnit and MbUnit, then Microsoft came to the party and cloned NUnit. These day's there's also xUnit and the exotic NBehave. Back when I was learning Java, there was pretty much just JUnit. You could write your tests in that one framework, and then they could be run pretty much anywhere (just like java ;)). You could use the JUnit console runner, the GUI runner, eclipse, intelliJ, NAnt, CruiseControl - they all knew how to run JUnit tests, because JUnit was the defacto. These days, in .Net, we get to choose between lots of different testing frameworks, each with their own strengths and weaknesses. Each of these frameworks comes with their own test runner, for example, visual studio is (arguably) capable of executing MsUnit (AKA MsTest AKA TfsUnit) tests. TestDriven.Net came along and made the visual studio integration much nicer. You'd also typically be executing these tests from MSBuild if you were trying to do Continuous Integration. NUnit has its own GUI for running NUnit tests, and there are a lot of third party NUnit test runners. Personally, I'm a big fan of the Resharper test runner, because you just click on the little green icon by your test and it's started testing. The test results window is what cinches the deal, it provides you with a hierarchical view of your test results, and makes it really easy to re-run whatever you like.

Resharper running NUnit tests

But it only works on Nunit:

Resharper NOT running MsUnit tests

James Kovacs had written a MsUnit plugin that let Resharper run MsUnit tests - but those crazy jetbrainers have been upgrading things again and now the plugin doesn't work. Enter Gallio:
The Gallio Automation Platform is an open, extensible, and neutral system for .NET that provides a common object model, runtime services and tools (such as test runners) that may be leveraged by any number of test frameworks.
Essentially, Gallio is a bridge between ALL of the testing frameworks I've just mentioned and a huge number of test runners. The number one thing for me is that now I can use the Resharper runner on my MsUnit tests. All I had to do was grab the installer off the Gallio website, run it, and the next time I started Visual Studio, Resharper was ready to run my MsUnit tests:

image

I'm impressed that the people behind Gallio have been able to define a common object model for all these different testing frameworks. I'd be really keen to see a Gallio plugin for TeamCity. Browsing through the Gallio discussions, it seems like it's definitely on its way. But seriously, I think Jetbrains should be lending a hand here: both with the TeamCity plugin and with Resharper. They'd only be helping themselves. NB: I just tried this with Resharper 4.1 RC2, and it seems like those rascally jetbrainers have broken things again. I'm sure the Gallio team will get right on it as soon as Resharper 4.1 is stable... If you're looking to get Gallio working with Reshaper 4.1+, check out Jeremy's comment on this post...
 
6 Comments

Posted in Testing