Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot have a PropertyAttribute named "Category" #1062

Open
iamdmitrij opened this issue Nov 29, 2021 · 1 comment
Open

Cannot have a PropertyAttribute named "Category" #1062

iamdmitrij opened this issue Nov 29, 2021 · 1 comment
Labels
confirm We need a separate confirmation of this issue

Comments

@iamdmitrij
Copy link

Using [Property("Category", "Test")] on a test, does not work as expected with property name "Category".

Property name with value "Category" is omitted from Visual Studio Test Explorer:

[Test]
[Property("Category", "Invisible")]
public void Test()
{
    Assert.Pass();
}

image

However, if property key is other than Category, tests [Property("FakeCategory", "Visible")] - it works perfectly fine.

image

[Test]
[Property("FakeCategory", "Visible")]
public void Test()
{
    Assert.Pass();
}

This is quite relevant if there are multiple test projects in solution using different frameworks - MSTest, xUnit, NUnit. In all mentioned frameworks except NUnit tagging with name and value where property name=Category works fine.

NUnit version: 3.13.2
IDE: Visual Studio 2022 17.0.1

@mikkelbu
Copy link
Member

mikkelbu commented Dec 8, 2021

@iamdmitrij I guess the problem is that NUnit has an explicit CategoryAttribute - see e.g. https://docs.nunit.org/articles/nunit/writing-tests/attributes/category.html - and as far as I can remember this attribute is actually just implemented using a property named Category.

So I guess the NUnit adapter has special handling of this Categories (a small test confirm this) - I guess it was made as part of #446. I'm unsure if one can configure this behaviour in the adapter, but as far as I can tell it is not possible to change. @OsirisTerje can you prodvide some more information - and should this be moved to the adapter project?

@mikkelbu mikkelbu added the confirm We need a separate confirmation of this issue label Dec 8, 2021
@OsirisTerje OsirisTerje transferred this issue from nunit/nunit Feb 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirm We need a separate confirmation of this issue
Projects
None yet
Development

No branches or pull requests

2 participants