Excluding NUnit categories


I am using NUnit categories to exclude tests. It seems that TeamCity does not handle the case when I am using a derived category attribute class:

    public class CategoryDatabase : CategoryAttribute
        public CategoryDatabase()
            : base("CategoryDatabase")
        { }

When I use the above attribute my tests are still being run. When I specify CategoryAttribute("CategoryDatabase") then they are excluded. It would be nice to be able to use the derived class, I think NUnit GUI allows this.


Comment actions Permalink

Hi Daniel

I've rechecked this with TeamCity 6.0.3 and NUnit 2.5.9, and wasn't reproduce the issue - excluded categories work fine, even with your code.
Can you confirm it using native nunit-console.exe?


Comment actions Permalink

Hello Michael,

I've rechecked this again and I think I understand what is going on. The category attributes I created were placed in a shared assembly that was referenced by my test projects. It seems that this does not work with NUnit, I checked it with nunit-console.exe and nunit.exe. When I move the attribute classes into my test projects then I can successfully exclude the marked tests. So it seems this is an issue with NUnit, not TeamCity. Thanks for the clarification!



Please sign in to leave a comment.