Pragmateek
Pragmateek

Reputation: 13354

NUnit multiple TestFixture equivalent for MsTest

In NUnit we can run a test-fixture multiple times with varying parameters simply by specifying multiple [TestFixture] attributes, each one causing the class to be instantiated with the specified attribute parameter.

Here is an example:

[TestFixture("A")]
[TestFixture("B")]
[TestFixture("C")]
public class MyTestClass
{
    public MyTestClass(string str)
    {
        ...

So the fixture would be instantiated 3 times: with str="A", then str="B" and finally str="C".

I'm trying to find the equivalent for the Visual Studio testing tools but the [TestClass] attribute can be specified only once.

I've read the doc but found no clue.

I can think of a simple workaround by using inheritance but I'm sure there is a simpler way.

Upvotes: 3

Views: 2845

Answers (1)

jessehouwing
jessehouwing

Reputation: 114461

There is no real equivalent. Closest I think is the Data Driven unit test.

Upvotes: 1

Related Questions