UPDATED
There is no simple method for identifying or loading selected categories in a NUnit test assembly in the NUnit framework itself.
Using reflection, you can scan the Categories
property in classes decorated with TestAttribute
or TestFixtureAttribute
. By comparing these categories with the ones you want to download, you can filter which tests to load before downloading.
And then there is the TestContext.Test.Properties
_CATEGORIES
key (available in NUnit 2.5.7 and later):
[Test] [Category("Hello")] public void TestCategory() { Assert.IsTrue(((ArrayList)TestContext.CurrentContext.Test.Properties["_CATEGORIES"]).Contains("Hello")); }
Read on to the TestContext
class here . Of course, to solve the problem with this approach, you will need to preload the entire test assembly and cycle through all the test cases, which is clearly undesirable in your scenario.
source share