views:

43

answers:

2

We have several hundred test classes, with a few dozen of them marked with the following attributes: [TestFixture] [Explicit] [Category("IntegrationTests")] so they will only be run in our over-night automated build. The remaining TestFixtures don't have a Category specified (and are not marked Explicit either).

Here is the NAnt task we are running to execute our tests:

<nunit2>
    <test>
        ...
        <categories>
            <include name="IntegrationTests" />
        </categories>
        ...
    </test>
</nunit2>

This, of course, will not execute any of the uncategorized tests.

I'd like to be able to do something like this:

<nunit2>
    <test>
        ...
        <categories>
            <include name="*" />
            <include name="IntegrationTests" />
        </categories>
        ...
    </test>
</nunit2>

where all of the uncategorized tests will be run along with the integration tests. Is this possible? If so, what is the syntax?

(Note: I'm looking for either a NAnt solution, as above, or an NUnit command-line solution. I can certainly run NUnit twice with different options, or put Categories on all of my TestFixtures. These are workarounds that I'm OK using if I have to, but it would be more cool to be able to specify uncategorized tests directly.)

A: 

No, given you situation there is no way to do what you want in a single run of NUnit. If you took off the explicit attribute, you could do it in a single run by excluding all the categorized tests you don't want.

Basically, if you make the jump to categories, all you tests should be categorized.

Russell McClure