views:

138

answers:

1

Dear ladies and sirs.

We are using mstest for unit tests at our company. The main reason is that there is no free Visual Studio integration for MbUnit (TestDriven.NET is not free for companies).

Recently, I have stumbled upon a need to run the same unit tests on two different implementations of the same interface. From my past experience I know it is easy to do with MbUnit. But, how to do it with MSTest?

I stress the point that I need separate results for each interface, so, please, do not offer things like running the same method twice - once per interface - from the same unit test method, because doing so yields only one result.

I am aware of the data driven solution and using it now, but it is a pain in the a*s. Is there an easier way, the MbUnit way?

Thanks.

+1  A: 

I don't know of an elegant way to do this in MSTest besides using its data-driven testing features. However, you might try using an abstract base class for your test fixture and then creating one subclass of it for each interface to be tested.

BTW, Gallio provides free integration with the Visual Studio test tools. We're also going to resume work on another add-in for Visual Studio as part of Gallio v3.2.

Jeff Brown
Hello Jeff. I have decided to give it a try, so I have downloaded Gallio. However, I do not find the CombinatorialTestAttribute when browsing the MbUnit.dll assembly with Reflector. Where can I find it?
mark
Found it in MbUnit.Framework.dll under MbUnit2 folder. Does it mean MbUnit v3 does not support combinatorial tests? Is there a place where I can read about it?
mark
It's just got a different syntax in v3. For a combinatorial test, just associate the data sources with the individual parameters of the test.[Test]public void MyTest([Column(1, 2, 3)] int number, [Column('a', 'b', 'c')] char letter) {...}You will find more examples here: http://blog.bits-in-motion.com/2008/05/announcing-gallio-v30-alpha-3.html
Jeff Brown