views:

248

answers:

3

In my NUnit testfixtrues i have something along the lines of

[Test,Category("catA")]
public void test1
{
    //
}

[Test,Category("catB")]
public void test2
{
    //
}

[Test,Category("catA")]
[Test,Category("catB")]
public void test3
{
    //
}

Now in the NUnit gui i want to be able to select catA and catB and run the tests where catA and catB are present. Currently this is not the case and NUnit will run all 3 tests.

Is there any way to change this behavior to an AND condition rather than OR?

I'm currently running v2.5.0.9122.

Thanks in advance.

+1  A: 

As far as I know you can't chose both of them as NUnit stands.

I tried a number of different things with NUnit and the way that my tests were created with no success.

I have found a site that talks you through the process of creating custom category attributes but still can't see how that may help.

AutomatedTester
yeah, i came across that one too. I'll take another look and have a think how i could go about bending it to my will but i think a change to the nunit gui may be in order for this to work.
Stimul8d
+1  A: 

Sounds like what you need is a third category of "catAandB".

Pedro
+1  A: 

No it there is no way to do that. To be honest when we first put the feature in several years ago I never thought of that. We tried to keep it as simple as possible.

By the way, you don't need to specify [Test] twice on you test3 method.

[Test]
[Category("catA")]
[Category("catB")]
public void test3
{
    //
}

Not that it makes a difference.

Mike Two