Category特性为suites的测试提供另外一个可替换功能。个别测试用例或者fixtures可能被识别为一个特殊的类别。GUI和控制台程序都允许在运行的测试中包含或者排除指定一系列category。当使用了category是,只有选定等等测试才会执行。未选中的测试则根本不会报告。
这个功能在控制台中使用/include and /exclude参数,在GUI中使用单独的Categories选项卡来实现。GUI提供了可视化操作用于随时选择Categories。、
Test Fixture Syntax
namespace NUnit.Tests { using System; using NUnit.Framework; [TestFixture] [Category("LongRunning")] public class LongRunningTests { // ... } }